/* ── Working overlay ────────────────────────────────────────────────────── */
.mgm-working-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--mgm-radius);
    font-size: 1.1rem;
    color: var(--mgm-accent);
    pointer-events: all;
    transition: opacity 0.2s;
}
.mgm-working-spinner {
    border: 3px solid #ede9fe;
    border-top: 3px solid var(--mgm-accent);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: mgm-spin 0.8s linear infinite;
    margin-right: 10px;
}
@keyframes mgm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* ==========================================================================
   MyGoalManager — shared.css
   Base variables, layout, buttons, cards, milestones, modal.
   ========================================================================== */

:root {
    --mgm-accent:       #7c3aed;
    --mgm-accent-light: #ede9fe;
    --mgm-accent-dark:  #5b21b6;
    --mgm-bg:           #f9fafb;
    --mgm-surface:      #ffffff;
    --mgm-border:       #e5e7eb;
    --mgm-text:         #111827;
    --mgm-muted:        #6b7280;
    --mgm-radius:       12px;
    --mgm-shadow:       0 4px 20px rgba(0, 0, 0, 0.07);
    --mgm-font:         'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* App wrapper */
.mgm-app {
    font-family: var(--mgm-font);
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px;
    color: var(--mgm-text);
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.mgm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.mgm-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--mgm-accent);
    margin: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.mgm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: var(--mgm-font);
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    line-height: 1;
}

.mgm-btn-primary {
    background: var(--mgm-accent);
    color: #fff;
}
.mgm-btn-primary:hover {
    background: var(--mgm-accent-dark);
    transform: translateY(-1px);
}

.mgm-btn-secondary {
    background: white;
    color: var(--mgm-accent);
    border: 2px solid var(--mgm-border);
}
.mgm-btn-secondary:hover {
    background: var(--mgm-accent-light);
    border-color: var(--mgm-accent);
}

.mgm-btn-sm {
    padding: 5px 11px;
    font-size: 0.85rem;
}

/* ── Toast Notification ──────────────────────────────────────────────────── */
.mgm-toast {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--mgm-accent);
    color: white;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 12px;
    animation: mgm-toast-in 0.3s ease-out;
}

.mgm-toast-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: mgm-spin 0.8s linear infinite;
}

@keyframes mgm-toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Add-goal form ───────────────────────────────────────────────────────── */
.mgm-add-goal {
    background: var(--mgm-surface);
    border: 1px solid var(--mgm-border);
    border-radius: var(--mgm-radius);
    box-shadow: var(--mgm-shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.mgm-add-goal input,
.mgm-add-goal textarea,
.mgm-add-goal select {
    font-family: var(--mgm-font);
    font-size: 0.95rem;
    padding: 10px 12px;
    border: 1px solid var(--mgm-border);
    border-radius: 8px;
    background: var(--mgm-bg);
    color: var(--mgm-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
}

.mgm-add-goal input:focus,
.mgm-add-goal textarea:focus,
.mgm-add-goal select:focus {
    border-color: var(--mgm-accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

/* ── Goal list ───────────────────────────────────────────────────────────── */
.mgm-goal-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

/* ── Goal card ───────────────────────────────────────────────────────────── */
.mgm-goal-card {
    background: var(--mgm-surface);
    border: 1px solid var(--mgm-border);
    border-radius: var(--mgm-radius);
    box-shadow: var(--mgm-shadow);
    padding: 18px 20px;
    transition: box-shadow 0.2s;
}
.mgm-goal-card:hover {
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.1);
}

.mgm-goal-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.mgm-goal-title {
    font-weight: 600;
    font-size: 1rem;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.mgm-goal-category-badge {
    display: inline-block;
    font-size: 0.75rem;
    color: white;
    border-radius: 20px;
    padding: 4px 12px;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mgm-goal-cat {
    font-size: 0.75rem;
    background: var(--mgm-accent-light);
    color: var(--mgm-accent);
    border-radius: 20px;
    padding: 2px 10px;
    font-weight: 600;
    white-space: nowrap;
}

.mgm-goal-desc {
    font-size: 0.88rem;
    color: var(--mgm-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}

.mgm-goal-actions {
    display: flex;
    gap: 4px;
}
.mgm-goal-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 3px 5px;
    border-radius: 4px;
    opacity: 0.55;
    transition: opacity 0.15s;
    line-height: 1;
}
.mgm-goal-actions button:hover { opacity: 1; }

/* ── Progress ────────────────────────────────────────────────────────────── */
.mgm-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.mgm-progress-slider {
    flex: 1;
    accent-color: var(--mgm-accent);
    cursor: pointer;
    height: 5px;
}

.mgm-progress-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--mgm-accent);
    min-width: 36px;
    text-align: right;
}

/* ── Milestones ──────────────────────────────────────────────────────────── */
.mgm-milestone-list {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mgm-milestone {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
}

.mgm-milestone.mgm-done .mgm-ms-text {
    text-decoration: line-through;
    color: var(--mgm-muted);
}

.mgm-ms-delete {
    background: none;
    border: none;
    color: var(--mgm-muted);
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: auto;
    padding: 0 4px;
    line-height: 1;
}
.mgm-ms-delete:hover { color: #dc2626; }

.mgm-add-milestone {
    display: flex;
    gap: 6px;
}

.mgm-ms-input {
    flex: 1;
    font-family: var(--mgm-font);
    font-size: 0.85rem;
    padding: 6px 10px;
    border: 1px solid var(--mgm-border);
    border-radius: 6px;
    outline: none;
    background: var(--mgm-bg);
    color: var(--mgm-text);
    transition: border-color 0.15s;
}
.mgm-ms-input:focus { border-color: var(--mgm-accent); }

/* ── Login notice ────────────────────────────────────────────────────────── */
.mgm-login-notice {
    text-align: center;
    padding: 40px 24px;
    color: var(--mgm-muted);
    font-size: 1rem;
}
.mgm-login-notice a {
    color: var(--mgm-accent);
    font-weight: 600;
    text-decoration: none;
}
.mgm-login-notice a:hover { text-decoration: underline; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.mgm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mgm-modal[hidden] { display: none; }

.mgm-modal-box {
    background: var(--mgm-surface);
    border-radius: var(--mgm-radius);
    padding: 36px 32px;
    max-width: 420px;
    width: 90%;
    position: relative;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.mgm-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--mgm-muted);
    line-height: 1;
}
.mgm-modal-close:hover { color: var(--mgm-text); }

.mgm-modal-box h3 {
    margin: 0 0 12px;
    font-size: 1.3rem;
    color: var(--mgm-accent);
}
.mgm-modal-box p {
    color: var(--mgm-muted);
    margin: 0 0 24px;
    line-height: 1.5;
}

/* ── Membership Badge (NEW) ──────────────────────────────────────────────── */
.mgm-membership-badge {
    background: linear-gradient(135deg, var(--mgm-accent) 0%, var(--mgm-accent-dark) 100%);
    color: white;
    padding: 16px 20px;
    border-radius: var(--mgm-radius);
    margin-bottom: 24px;
    box-shadow: var(--mgm-shadow);
}

.mgm-badge-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
}

.mgm-badge-label {
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    font-weight: 700;
    flex-shrink: 0;
    color: white;
}

.mgm-badge-user {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
    min-width: 0;
    word-break: break-word;
    line-height: 1.3;
    color: white;
}

.mgm-badge-type {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    color: white;
}

/* ── Category Filter (NEW) ───────────────────────────────────────────────── */
.mgm-category-filter-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px;
    background: var(--mgm-bg);
    border-radius: var(--mgm-radius);
    flex-wrap: wrap;
}

.mgm-category-filter-container label {
    font-weight: 600;
    color: var(--mgm-text);
    white-space: nowrap;
}

.mgm-category-filter {
    flex: 1;
    min-width: 150px;
    padding: 10px 12px;
    border: 1px solid var(--mgm-border);
    border-radius: 8px;
    font-family: var(--mgm-font);
    font-size: 1rem;
    color: var(--mgm-text);
    background: var(--mgm-surface);
    cursor: pointer;
    transition: all 0.2s;
}

.mgm-category-filter:hover,
.mgm-category-filter:focus {
    outline: none;
    border-color: var(--mgm-accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* ── Category Items (NEW) ────────────────────────────────────────────────── */
.mgm-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--mgm-accent);
    transition: all 0.2s;
}

.mgm-category-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateX(2px);
}

.mgm-categories-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 8px;
}

/* ── Input Styles (NEW) ──────────────────────────────────────────────────── */
.mgm-input {
    padding: 10px 12px;
    border: 1px solid var(--mgm-border);
    border-radius: 8px;
    font-family: var(--mgm-font);
    font-size: 1rem;
    color: var(--mgm-text);
    background: var(--mgm-surface);
    transition: all 0.2s;
}

.mgm-input:focus {
    outline: none;
    border-color: var(--mgm-accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* ── Secondary Button ────────────────────────────────────────────────────── */
.mgm-btn-secondary {
    background-color: var(--mgm-border);
    color: var(--mgm-text);
    border: 1px solid var(--mgm-border);
}

.mgm-btn-secondary:hover {
    background-color: #d1d5db;
    border-color: #d1d5db;
}

/* ── No Goals / Loading States ───────────────────────────────────────────── */
.mgm-no-goals {
    padding: 40px 20px;
    text-align: center;
    color: var(--mgm-muted);
    font-size: 1.1rem;
}

.mgm-loading-goals {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--mgm-muted);
    font-size: 1.1rem;
    gap: 12px;
}

.mgm-spinner {
    border: 3px solid var(--mgm-accent-light);
    border-top: 3px solid var(--mgm-accent);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: mgm-spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* ── Reminder Modal Form (NEW) ───────────────────────────────────────────── */
.mgm-reminder-btn {
    background: none;
    border: none;
    font-size: 1rem;
    padding: 3px 5px;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s;
    line-height: 1;
}
.mgm-reminder-btn:hover { opacity: 1; }

.mgm-form-group {
    text-align: left;
    margin-bottom: 16px;
}

.mgm-form-group label {
    display: block;
    font-weight: 600;
    color: var(--mgm-text);
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.mgm-form-group input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
    accent-color: var(--mgm-accent);
}

.mgm-form-group input[type="checkbox"] + label {
    display: inline;
    font-weight: normal;
    margin: 0;
}

.mgm-form-group select,
.mgm-form-group input[type="time"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--mgm-border);
    border-radius: 8px;
    font-family: var(--mgm-font);
    font-size: 0.95rem;
    color: var(--mgm-text);
    background: var(--mgm-surface);
    transition: all 0.2s;
    box-sizing: border-box;
}

.mgm-form-group select:focus,
.mgm-form-group input[type="time"]:focus {
    outline: none;
    border-color: var(--mgm-accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .mgm-app    { padding: 16px 10px; }
    .mgm-header { flex-direction: column; align-items: flex-start; }
    .mgm-goal-top { flex-wrap: wrap; }
}
