/* ==================== MUNDO ALICE - DESIGN SYSTEM v4 ==================== */
/* Verde sofisticado padrão + Temas selecionáveis + Dark/Light mode */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,500;0,9..40,700;0,9..40,800;1,9..40,400&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    /* === TEMA PADRÃO: Verde Esmeralda Sofisticado (Light) === */
    --accent: #059669;
    --accent-hover: #047857;
    --accent-light: #ecfdf5;
    --accent-text: #065f46;
    --accent-muted: rgba(5,150,105,0.12);

    /* Backgrounds */
    --bg-primary: #f7f8f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f4;
    --bg-elevated: #ffffff;
    --bg-input: #f7f8f9;
    --bg-sidebar: #022c22;
    --bg-sidebar-hover: #064e3b;
    --bg-sidebar-active: #065f46;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;
    --text-on-sidebar: #a7f3d0;
    --text-on-sidebar-muted: #6ee7b7;

    /* Borders */
    --border-primary: #e5e7eb;
    --border-secondary: #f3f4f6;

    /* Semantic */
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --pink: #ec4899;
    --pink-light: #fdf2f8;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --indigo: #6366f1;
    --indigo-light: #eef2ff;

    /* Effects */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.1);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Fonts */
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === DARK MODE === */
[data-theme="dark"] {
    --bg-primary: #0c1015;
    --bg-secondary: #151b23;
    --bg-tertiary: #1c242e;
    --bg-elevated: #1c242e;
    --bg-input: #1c242e;
    --bg-sidebar: #0a0f14;
    --bg-sidebar-hover: #151b23;
    --bg-sidebar-active: #1c242e;

    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --text-inverse: #0c1015;
    --text-on-sidebar: #6ee7b7;
    --text-on-sidebar-muted: #34d399;

    --border-primary: #2a3441;
    --border-secondary: #1f2937;

    --accent-light: #052e16;
    --success-light: #052e16;
    --warning-light: #451a03;
    --danger-light: #450a0a;
    --info-light: #172554;
    --pink-light: #500724;
    --purple-light: #2e1065;
    --indigo-light: #1e1b4b;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.6);
}

/* === TEMAS DE COR (acento customizável) === */
[data-accent="emerald"] { --accent:#059669; --accent-hover:#047857; --accent-light:#ecfdf5; --accent-text:#065f46; --accent-muted:rgba(5,150,105,0.12); --bg-sidebar:#022c22; --bg-sidebar-hover:#064e3b; --bg-sidebar-active:#065f46; --text-on-sidebar:#a7f3d0; --text-on-sidebar-muted:#6ee7b7; }
[data-accent="indigo"] { --accent:#6366f1; --accent-hover:#4f46e5; --accent-light:#eef2ff; --accent-text:#4338ca; --accent-muted:rgba(99,102,241,0.12); --bg-sidebar:#1e1b4b; --bg-sidebar-hover:#312e81; --bg-sidebar-active:#3730a3; --text-on-sidebar:#c7d2fe; --text-on-sidebar-muted:#a5b4fc; }
[data-accent="rose"] { --accent:#e11d48; --accent-hover:#be123c; --accent-light:#fff1f2; --accent-text:#9f1239; --accent-muted:rgba(225,29,72,0.12); --bg-sidebar:#4c0519; --bg-sidebar-hover:#881337; --bg-sidebar-active:#9f1239; --text-on-sidebar:#fecdd3; --text-on-sidebar-muted:#fda4af; }
[data-accent="amber"] { --accent:#d97706; --accent-hover:#b45309; --accent-light:#fffbeb; --accent-text:#92400e; --accent-muted:rgba(217,119,6,0.12); --bg-sidebar:#451a03; --bg-sidebar-hover:#78350f; --bg-sidebar-active:#92400e; --text-on-sidebar:#fde68a; --text-on-sidebar-muted:#fcd34d; }
[data-accent="cyan"] { --accent:#0891b2; --accent-hover:#0e7490; --accent-light:#ecfeff; --accent-text:#155e75; --accent-muted:rgba(8,145,178,0.12); --bg-sidebar:#083344; --bg-sidebar-hover:#155e75; --bg-sidebar-active:#164e63; --text-on-sidebar:#a5f3fc; --text-on-sidebar-muted:#67e8f9; }
[data-accent="violet"] { --accent:#7c3aed; --accent-hover:#6d28d9; --accent-light:#f5f3ff; --accent-text:#5b21b6; --accent-muted:rgba(124,58,237,0.12); --bg-sidebar:#2e1065; --bg-sidebar-hover:#4c1d95; --bg-sidebar-active:#5b21b6; --text-on-sidebar:#ddd6fe; --text-on-sidebar-muted:#c4b5fd; }

/* Dark mode overrides for accent themes */
[data-theme="dark"][data-accent="emerald"] { --accent-light:#052e16; --bg-sidebar:#040d09; --bg-sidebar-hover:#052e16; --bg-sidebar-active:#064e3b; }
[data-theme="dark"][data-accent="indigo"] { --accent-light:#1e1b4b; --bg-sidebar:#0c0b24; --bg-sidebar-hover:#1e1b4b; --bg-sidebar-active:#312e81; }
[data-theme="dark"][data-accent="rose"] { --accent-light:#4c0519; --bg-sidebar:#1f0109; --bg-sidebar-hover:#4c0519; --bg-sidebar-active:#881337; }
[data-theme="dark"][data-accent="amber"] { --accent-light:#451a03; --bg-sidebar:#1c0a01; --bg-sidebar-hover:#451a03; --bg-sidebar-active:#78350f; }
[data-theme="dark"][data-accent="cyan"] { --accent-light:#083344; --bg-sidebar:#021a24; --bg-sidebar-hover:#083344; --bg-sidebar-active:#155e75; }
[data-theme="dark"][data-accent="violet"] { --accent-light:#2e1065; --bg-sidebar:#120633; --bg-sidebar-hover:#2e1065; --bg-sidebar-active:#4c1d95; }

/* ==================== BASE ==================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
.hidden { display: none !important; }

/* ==================== THEME CONTROLS ==================== */
.theme-toggle {
    width: 44px; height: 24px;
    background: var(--border-primary);
    border-radius: var(--radius-full);
    border: none; cursor: pointer;
    position: relative;
    transition: background var(--transition);
    flex-shrink: 0;
}
.theme-toggle::after {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent);
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
[data-theme="dark"] .theme-toggle::after { transform: translateX(20px); }

.accent-dot {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}
.accent-dot:hover { transform: scale(1.15); }
.accent-dot.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0,0,0,0.3); }

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

/* ==================== INPUTS ==================== */
.input-style {
    width: 100%;
    border: 1.5px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 14px;
    font-family: var(--font-sans);
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
}
.input-style:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-muted); }
.input-style:disabled { opacity: 0.5; cursor: not-allowed; }
.input-style::placeholder { color: var(--text-tertiary); }
select.input-style { cursor: pointer; }

.label-style {
    display: block;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ==================== BUTTONS ==================== */
.btn-primary {
    width: 100%; background: var(--accent); color: #fff;
    padding: 14px; border-radius: var(--radius-md);
    font-weight: 700; font-size: 14px;
    font-family: var(--font-sans);
    border: none; cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-big {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff; font-weight: 800; padding: 18px;
    border-radius: var(--radius-lg); border: none; cursor: pointer;
    font-size: 16px; text-transform: uppercase; letter-spacing: 0.02em;
    font-family: var(--font-sans);
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
}
.btn-big:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.btn-big:active { transform: scale(0.97); }

.btn-size-select {
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 700; font-family: var(--font-sans);
    padding: 14px; border-radius: var(--radius-md);
    cursor: pointer; transition: all var(--transition); font-size: 14px;
}
.btn-size-select:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* === BOTÕES DE AÇÃO (exclusão/edição) REDESENHADOS === */
.btn-action-delete {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    border: none; cursor: pointer;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 14px;
    transition: all var(--transition);
    opacity: 0.5;
}
.btn-action-delete:hover {
    background: var(--danger-light);
    color: var(--danger);
    opacity: 1;
}

.btn-action-edit {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    border: none; cursor: pointer;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 13px;
    transition: all var(--transition);
    opacity: 0.5;
}
.btn-action-edit:hover {
    background: var(--accent-light);
    color: var(--accent);
    opacity: 1;
}

.btn-action-small {
    font-size: 10px; font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.btn-action-small:hover { border-color: var(--accent); color: var(--accent); }

/* Legacy compat */
.btn-delete { display:none; }
.btn-loading { opacity: 0.6; pointer-events: none; }

/* ==================== SIDEBAR ==================== */
.sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: 280px;
    background: var(--bg-sidebar);
    color: var(--text-on-sidebar);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 50;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-xl);
}
.sidebar.open { transform: translateX(0); }

.overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 40; display: none; opacity: 0;
    transition: opacity 0.3s ease;
}
.overlay.open { display: block; opacity: 1; }

.menu-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 24px; cursor: pointer;
    transition: all var(--transition);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-on-sidebar);
    font-size: 14px; font-weight: 500;
    position: relative;
}
.menu-item:hover { background: var(--bg-sidebar-hover); }
.menu-item.active {
    background: var(--bg-sidebar-active);
    color: #fff; font-weight: 700;
    border-left: 3px solid var(--text-on-sidebar);
}

/* ==================== MODALS ==================== */
.modal-bg {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
    z-index: 60; display: none;
    align-items: center; justify-content: center;
    padding: 16px; opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-bg.open { display: flex; opacity: 1; }
.modal-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
    padding: 28px; width: 100%; max-width: 380px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-primary);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}
.modal-bg.open .modal-box { transform: scale(1); }

/* ==================== TABS & FILTERS ==================== */
.auth-tab {
    flex: 1; padding: 14px 0; text-align: center;
    font-weight: 600; font-size: 13px; cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    color: var(--text-tertiary);
    background: none; border-top: none; border-left: none; border-right: none;
    font-family: var(--font-sans);
}
.auth-tab.active { border-bottom-color: var(--accent); color: var(--accent); }
.auth-tab.inactive:hover { color: var(--text-secondary); }

.tab-content { position: relative; min-height: 60vh; }

.filter-btn {
    padding: 6px 14px; border-radius: var(--radius-full);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    transition: all var(--transition);
    white-space: nowrap; border: none; cursor: pointer;
    font-family: var(--font-sans);
}
.filter-active { background: var(--accent); color: #fff; }
.filter-inactive { background: var(--bg-tertiary); color: var(--text-tertiary); }
.filter-inactive:hover { color: var(--text-secondary); }

/* ==================== PREMIUM LOCK ==================== */
.premium-lock, .premium-lock-small {
    position: absolute; inset: 0;
    backdrop-filter: blur(8px); z-index: 40;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 24px; text-align: center;
    border-radius: var(--radius-xl);
}

/* ==================== LISTS ==================== */
.list-item-row {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-tertiary);
    padding: 10px 14px; border-radius: var(--radius-md);
    border: 1px solid var(--border-secondary);
    font-size: 13px; margin-bottom: 6px;
    transition: all var(--transition);
}

/* ==================== STOCK ==================== */
.stock-card {
    background: var(--bg-secondary);
    padding: 14px 16px; border-radius: var(--radius-lg);
    border: 1px solid var(--border-secondary);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    margin-bottom: 8px;
}
.progress-bg {
    width: 100%; background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    height: 5px; margin-top: 8px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: var(--radius-full); transition: width 1s cubic-bezier(0.4,0,0.2,1); }

/* ==================== HEALTH ==================== */
.clean-item {
    background: var(--bg-secondary);
    padding: 14px; border-radius: var(--radius-lg);
    border: 1px solid var(--border-secondary);
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
}
.clean-badge {
    font-size: 10px; font-weight: 800;
    padding: 3px 8px; border-radius: var(--radius-full);
    text-transform: uppercase; letter-spacing: 0.02em;
}

/* ==================== VACCINE ==================== */
.notebook-page {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border-top: 4px solid var(--info);
    padding: 20px; position: relative;
    overflow: hidden; box-shadow: var(--shadow-sm);
}
.notebook-dot { width: 6px; height: 6px; background: var(--info-light); border-radius: 50%; margin-bottom: 3px; }

.month-scroller { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.month-scroller::-webkit-scrollbar { display: none; }
.month-btn {
    padding: 6px 14px; border-radius: var(--radius-lg);
    font-size: 11px; font-weight: 800;
    text-transform: uppercase; transition: all var(--transition);
    white-space: nowrap; border: 2px solid transparent;
    cursor: pointer; font-family: var(--font-sans);
}
.month-btn.active { background: var(--info); color: #fff; box-shadow: var(--shadow-md); border-color: var(--info); }
.month-btn.inactive { background: var(--bg-tertiary); color: var(--text-tertiary); border-color: var(--border-secondary); }

/* ==================== TIMELINE ==================== */
.timeline-container { position: relative; padding-bottom: 16px; margin-left: 8px; }
.timeline-line { position: absolute; left: 16px; top: 0; bottom: 0; width: 2px; background: var(--border-primary); z-index: 0; }
.dot-diary { position: absolute; left: 11px; width: 12px; height: 12px; background: var(--accent); border-radius: 50%; border: 2px solid var(--bg-secondary); z-index: 10; }

/* ==================== AUTH ==================== */
.auth-screen-bg { background: var(--bg-primary); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-card { background: var(--bg-secondary); border-radius: var(--radius-2xl); box-shadow: var(--shadow-xl); width: 100%; max-width: 420px; overflow: hidden; border: 1px solid var(--border-primary); }
.auth-header { padding: 32px 24px; text-align: center; background: linear-gradient(135deg, var(--accent-light), var(--bg-secondary)); border-bottom: 1px solid var(--border-primary); }

/* ==================== TOAST ==================== */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--bg-sidebar); color: #fff;
    padding: 12px 24px; border-radius: var(--radius-lg);
    font-size: 13px; font-weight: 600;
    box-shadow: var(--shadow-xl); z-index: 200;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
    font-family: var(--font-sans);
}
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(16px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateX(-50%) translateY(16px); } }
@keyframes slideDown { from { transform:translateY(-100%); } to { transform:translateY(0); } }
@keyframes slideUp { from { transform:translateY(0); } to { transform:translateY(-100%); } }

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: var(--radius-full); }

/* ==================== ANIMATIONS ==================== */
.animate-pulse { animation: pulse 2s cubic-bezier(0.4,0,0.6,1) infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }
.animate-bounce { animation: bounce 1s infinite; }
@keyframes bounce { 0%,100% { transform:translateY(-5%); } 50% { transform:translateY(0); } }

/* ==================== FORM ELEMENTS DARK MODE ==================== */
input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .card { padding: 16px; border-radius: var(--radius-lg); }
    .modal-box { padding: 20px; }
}