/*
 * Mac UX Design System — Festeje
 * Tipografia: Poppins (marca). Paleta: preto / dourado / branco.
 */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    /* ====== Tipografia ====== */
    --font-sans: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

    /* ====== Cores — Identidade Festeje: Preto / Dourado / Branco ====== */
    --bg-base: #f7f6f2;            /* branco quente, combina com dourado */
    --bg-surface: rgba(255,255,255,0.78);   /* frosted panel */
    --bg-surface-solid: #ffffff;
    --bg-hover: rgba(0,0,0,0.04);
    --bg-active: rgba(0,0,0,0.08);
    --bg-elevated: #ffffff;

    --text-primary: #0a0a0a;       /* preto da marca */
    --text-secondary: #4a4a4f;
    --text-tertiary: #8a8a90;
    --text-inverse: #ffffff;

    --border: rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.16);
    --divider: rgba(0,0,0,0.06);

    /* ===== Cores de marca ===== */
    --black: #0a0a0a;
    --black-soft: #1a1a1d;
    --white: #ffffff;
    --gold: #c9a227;               /* dourado principal */
    --gold-light: #e5c76b;         /* realce claro */
    --gold-soft: #f2dfa3;           /* tom suave para backgrounds */
    --gold-dark: #a78519;          /* hover / pressionado */
    --gold-deep: #8b6f1a;          /* uso em texto sobre claro */

    /* Cores dos balões de mensagem — variáveis sobrescritas por tema.
       Padrão ouro/preto da marca: enviado em ouro, recebido em preto fosco. */
    --bubble-sent-bg: linear-gradient(140deg, #c9a227 0%, #b8911e 55%, #a78519 100%);
    --bubble-sent-text: #ffffff;
    --bubble-received-bg: linear-gradient(140deg, #1c1c1e 0%, #2b2b2e 100%);
    --bubble-received-text: #ffffff;

    /* Compatibilidade (cores usadas em badges/status — preservadas) */
    --blue: #007aff;
    --indigo: #5856d6;
    --purple: #af52de;
    --pink: #ff2d55;
    --red: #ff3b30;
    --orange: #ff9500;
    --yellow: #ffcc00;
    --green: #34c759;
    --teal: #5ac8fa;
    --mint: #00c7be;

    --accent: var(--gold);
    --accent-hover: var(--gold-dark);
    --accent-contrast: var(--black);   /* cor legível sobre o dourado */

    /* Gradientes — marca preto/dourado */
    --grad-festeje: linear-gradient(135deg, #0a0a0a 0%, #3a2e10 45%, #c9a227 100%);
    --grad-gold:    linear-gradient(135deg, #a78519 0%, #c9a227 50%, #e5c76b 100%);
    --grad-black:   linear-gradient(135deg, #0a0a0a 0%, #2b2b2e 100%);
    --grad-sunset:  linear-gradient(135deg, #a78519, #c9a227);
    --grad-ocean:   linear-gradient(135deg, #e5c76b, #c9a227);
    --grad-mint:    linear-gradient(135deg, #e5c76b, #8b6f1a);

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.12);
    --shadow-window: 0 30px 80px rgba(0,0,0,0.18), 0 0 0 0.5px rgba(0,0,0,0.1);

    /* Raios */
    --r-xs: 6px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-pill: 9999px;

    /* Animacoes */
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Festeje usa apenas tema claro — nunca adicionar dark mode aqui. */

/* ====== Reset ====== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.01em;
}

a, a:hover, a:focus, a:active, a:visited { text-decoration: none; }
a { color: var(--accent); }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

p { margin: 0 0 16px; color: var(--text-secondary); }

button, input, textarea, select {
    font-family: inherit; font-size: inherit;
    color: inherit;
}

::selection { background: var(--gold); color: var(--black); }

/* ====== Scrollbar estilo Mac ====== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.22);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.36); background-clip: padding-box; }

/* ====== Utilidades ====== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 28px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 16px; align-items: center; }
.spacer { flex: 1; }

/* ====== Card / Surface ====== */
.mac-card {
    background: var(--bg-elevated);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    border: 0.5px solid var(--border);
    padding: 24px;
}

.mac-surface {
    background: var(--bg-surface);
    backdrop-filter: saturate(180%) blur(22px);
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    border: 0.5px solid var(--border);
    border-radius: var(--r-lg);
}

/* ====== Botoes ====== */
.mac-btn {
    appearance: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border-radius: var(--r-sm);
    border: 0.5px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-weight: 500; font-size: 13px;
    cursor: pointer;
    transition: transform 120ms var(--ease), background 120ms var(--ease), box-shadow 120ms var(--ease);
    box-shadow: var(--shadow-sm);
}
.mac-btn:hover { background: var(--bg-hover); }
.mac-btn:active { transform: scale(0.97); background: var(--bg-active); }
.mac-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.mac-btn-primary {
    background: var(--gold);
    color: var(--black);
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(201,162,39,0.40), 0 4px 12px rgba(201,162,39,0.28);
}
.mac-btn-primary:hover { background: var(--gold-dark); color: #fff; }

.mac-btn-ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}
.mac-btn-ghost:hover { background: var(--bg-hover); }

.mac-btn-danger {
    background: var(--red); color: #fff; border-color: transparent;
}
.mac-btn-danger:hover { background: #d9302a; }

/* ====== Inputs ====== */
.mac-input, .mac-textarea, .mac-select {
    width: 100%;
    padding: 11px 14px;
    border: 0.5px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.mac-input:focus, .mac-textarea:focus, .mac-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,162,39,0.22);
}
.mac-input::placeholder { color: var(--text-tertiary); }

.mac-field { display: flex; flex-direction: column; gap: 8px; }
.mac-field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

/* ====== Janela Mac (Traffic Lights) ====== */
.mac-window {
    background: var(--bg-elevated);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-window);
    overflow: hidden;
    border: 0.5px solid var(--border);
}
.mac-titlebar {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border-bottom: 0.5px solid var(--divider);
    user-select: none;
}
.mac-traffic { display: flex; gap: 8px; }
.mac-traffic .dot {
    width: 12px; height: 12px; border-radius: 50%;
    display: inline-block;
}
.mac-traffic .dot.red { background: #ff5f57; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.08); }
.mac-traffic .dot.yellow { background: #ffbd2e; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.08); }
.mac-traffic .dot.green { background: #28c940; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.08); }
.mac-title {
    flex: 1; text-align: center;
    font-size: 13px; font-weight: 600;
    color: var(--text-secondary);
}

/* ====== Dock ====== */
.mac-dock {
    position: fixed;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 16px;
    background: var(--bg-surface);
    backdrop-filter: saturate(180%) blur(28px);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
    border: 0.5px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}
.mac-dock-item {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    cursor: pointer;
    font-size: 24px;
    transition: transform 180ms var(--ease-spring);
    position: relative;
    border: 0.5px solid var(--border);
}
.mac-dock-item:hover { transform: translateY(-8px) scale(1.12); }
.mac-dock-item::after {
    content: attr(data-label);
    position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    background: rgba(0,0,0,0.82);
    color: #fff;
    font-size: 11px; font-weight: 500;
    white-space: nowrap;
    border-radius: var(--r-xs);
    opacity: 0; pointer-events: none;
    transition: opacity 120ms var(--ease);
}
.mac-dock-item:hover::after { opacity: 1; }

/* ====== Sidebar ====== */
.mac-sidebar {
    width: 240px; flex-shrink: 0;
    background: var(--bg-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 0.5px solid var(--divider);
    padding: 20px 12px;
    overflow-y: auto;
}
.mac-sidebar-section { margin-bottom: 24px; }
.mac-sidebar-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    color: var(--text-tertiary); padding: 0 14px 8px;
    letter-spacing: 0.04em;
}
.mac-sidebar-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: var(--r-sm);
    color: var(--text-primary);
    cursor: pointer; font-size: 13.5px;
    transition: background 100ms var(--ease);
}
.mac-sidebar-item:hover { background: var(--bg-hover); }
.mac-sidebar-item.active { background: var(--gold); color: var(--black); }
.mac-sidebar-item.active i, .mac-sidebar-item.active .icon { color: var(--black); }
.mac-sidebar-item i, .mac-sidebar-item .icon {
    width: 20px; text-align: center; font-size: 14px;
    color: var(--text-secondary);
}

/* ====== Badge / Pill ====== */
.mac-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 11px; font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.mac-badge.blue   { background: var(--blue); color: #fff; }
.mac-badge.green  { background: var(--green); color: #fff; }
.mac-badge.red    { background: var(--red); color: #fff; }
.mac-badge.yellow { background: var(--yellow); color: #1d1d1f; }
.mac-badge.purple { background: var(--purple); color: #fff; }
.mac-badge.gold   { background: var(--gold); color: var(--black); }
.mac-badge.black  { background: var(--black); color: var(--gold-light); }

/* ====== Divisor ====== */
.mac-divider { height: 0.5px; background: var(--divider); margin: 20px 0; border: 0; }

/* ====== Fade-in on mount ====== */
.mac-fade-in { animation: macFadeIn 260ms var(--ease) both; }
@keyframes macFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ====== Spinner ====== */
.mac-spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: macSpin 0.7s linear infinite;
    display: inline-block;
}
@keyframes macSpin { to { transform: rotate(360deg); } }

/* ====== Toast ====== */
.mac-toast {
    position: fixed; top: 24px; right: 24px;
    padding: 14px 18px;
    background: var(--bg-elevated);
    border: 0.5px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px; font-weight: 500;
    z-index: 10000;
    animation: macFadeIn 200ms var(--ease) both;
    min-width: 220px; max-width: 360px;
}
.mac-toast.success { border-left: 3px solid var(--green); }
.mac-toast.error   { border-left: 3px solid var(--red); }
.mac-toast.info    { border-left: 3px solid var(--gold); }
.mac-toast.warning { border-left: 3px solid var(--orange); }

/* ====== Banner global de WhatsApp desconectado ====== */
.mac-wa-alert {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 9998;
    padding: 10px 18px;
    background: linear-gradient(90deg, #ff3b30, #ff9500);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.18);
    animation: macFadeIn 220ms var(--ease) both;
}
.mac-wa-alert .mac-wa-alert-text { flex: 1; line-height: 1.35; }
.mac-wa-alert button {
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.mac-wa-alert button:hover { background: rgba(255,255,255,.28); }
.mac-wa-alert button:disabled { opacity: .55; cursor: not-allowed; }

/* ====== Botão X universal para fechar modais ====== */
.modal-close-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 7px;
    background: transparent; border: none;
    color: var(--text-secondary);
    font-size: 14px; cursor: pointer;
    margin-left: auto; flex-shrink: 0;
    transition: background 120ms, color 120ms;
}
.modal-close-btn:hover {
    background: rgba(255, 59, 48, 0.12);
    color: var(--red);
}

/* ========== TEMAS ==========
   Aplicados via <html data-theme="X">. "Claro" é o default (já é o :root).
   Cada tema sobrescreve apenas as variáveis-chave; o resto do design system
   se adapta automaticamente. Persiste em localStorage.festeje_theme.       */
html[data-theme="dark"], html[data-theme="dark"] body {
    --bg-base: #0f1115;
    --bg-surface: rgba(28,28,32,0.78);
    --bg-surface-solid: #1c1c20;
    --bg-hover: rgba(255,255,255,0.06);
    --bg-active: rgba(255,255,255,0.1);
    --bg-elevated: #1c1c20;
    --text-primary: #f5f5f7;
    --text-secondary: #c0c0c5;
    --text-tertiary: #80808a;
    --border: rgba(255,255,255,0.10);
    --border-strong: rgba(255,255,255,0.20);
    --divider: rgba(255,255,255,0.08);
    --bubble-sent-bg: linear-gradient(140deg, #2563eb, #1d4ed8);
    --bubble-sent-text: #ffffff;
    --bubble-received-bg: linear-gradient(140deg, #5b21b6, #6d28d9);
    --bubble-received-text: #ffffff;
    color-scheme: dark;
}
html[data-theme="festeje"] {
    --bg-base: #fafaff;
    --bg-elevated: #ffffff;
    --bg-surface: rgba(255,255,255,0.78);
    --bg-hover: rgba(99,102,241,0.06);
    --bg-active: rgba(99,102,241,0.12);
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-contrast: #ffffff;
    --grad-festeje: linear-gradient(135deg, #ff2d55, #af52de, #007aff);
    --grad-gold: linear-gradient(135deg, #6366f1, #ec4899);
    --bubble-sent-bg: linear-gradient(140deg, #6366f1 0%, #7c3aed 55%, #ec4899 100%);
    --bubble-sent-text: #ffffff;
    --bubble-received-bg: linear-gradient(140deg, #1e293b, #334155);
    --bubble-received-text: #ffffff;
}
html[data-theme="ocean"] {
    --bg-base: #f0f7fa;
    --bg-elevated: #ffffff;
    --bg-surface: rgba(255,255,255,0.78);
    --bg-hover: rgba(14,165,233,0.06);
    --bg-active: rgba(14,165,233,0.12);
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-contrast: #ffffff;
    --grad-festeje: linear-gradient(135deg, #06b6d4, #0ea5e9, #6366f1);
    --grad-gold: linear-gradient(135deg, #06b6d4, #6366f1);
    --bubble-sent-bg: linear-gradient(140deg, #06b6d4 0%, #0ea5e9 55%, #2563eb 100%);
    --bubble-sent-text: #ffffff;
    --bubble-received-bg: linear-gradient(140deg, #0f766e, #115e59);
    --bubble-received-text: #ffffff;
}
html[data-theme="sepia"] {
    --bg-base: #f5ecd9;
    --bg-elevated: #fdf6e3;
    --bg-surface: rgba(253,246,227,0.85);
    --bg-hover: rgba(140,100,40,0.06);
    --bg-active: rgba(140,100,40,0.12);
    --text-primary: #3a2d1a;
    --text-secondary: #6b5a3a;
    --text-tertiary: #9c8765;
    --border: rgba(140,100,40,0.16);
    --divider: rgba(140,100,40,0.10);
    --bubble-sent-bg: linear-gradient(140deg, #8b6f1a, #a78519);
    --bubble-sent-text: #fdf6e3;
    --bubble-received-bg: linear-gradient(140deg, #5d4423, #3a2d1a);
    --bubble-received-text: #fdf6e3;
}

/* Theme picker (compartilhado entre páginas) */
.theme-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-picker button {
    border: 1.5px solid var(--border); cursor: pointer;
    width: 56px; height: 56px; border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; padding: 0;
    background: var(--bg-elevated); color: var(--text-primary);
    transition: transform 120ms, box-shadow 120ms;
    font-size: 10px; font-weight: 600;
}
.theme-picker button:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.theme-picker button.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.18);
}
.theme-picker .swatch {
    width: 28px; height: 16px; border-radius: 6px;
    border: 0.5px solid rgba(0,0,0,0.1);
}
