@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Lato:wght@300;400;700&display=swap');

/* --- 1. VARIÁVEIS E CORES --- */
:root {
    --gold: #d4af37;
    --gold-hover: #b5952f;
    --gold-dim: #997b2f;
    
    --bg-dark: #0f172a;       /* Fundo principal */
    --bg-darker: #020617;     /* Fundo gradiente */
    --bg-panel: #1e293b;      /* Painel de ferramentas */
    
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shine: rgba(255, 255, 255, 0.03);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    
    --mason-blue: #3b82f6;
    --mason-bg: rgba(59, 130, 246, 0.15);
    --family-pink: #ec4899;
    --family-bg: rgba(236, 72, 153, 0.15);
    
    --success: #10b981;
    --shadow-gold: 0 10px 30px -10px rgba(212, 175, 55, 0.3);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Seleção de texto dourada */
::selection { background: var(--gold); color: var(--bg-darker); }

body {
    background: linear-gradient(135deg, var(--bg-darker) 0%, #1e1b4b 100%);
    color: var(--text-primary);
    font-family: 'Lato', sans-serif;
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-darker); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* --- 2. CABEÇALHO (HEADER) --- */
.dashboard-header {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 0;
    position: sticky; /* Sticky se quiser fixar, mas a busca já é sticky */
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-section { display: flex; align-items: center; gap: 15px; }

.site-logo {
    height: 45px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
    transition: transform 0.3s;
}
.site-logo:hover { transform: scale(1.05); }

.logo-section h1 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    margin: 0;
    font-size: 1.6rem;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.stats-bar {
    display: flex;
    gap: 25px;
    background: rgba(255,255,255,0.03);
    padding: 8px 20px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
}

.stat-item { text-align: center; }
.stat-number { display: block; font-size: 1.1rem; font-weight: 700; color: white; }
.stat-label { font-size: 0.7rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.5px; }

/* --- 3. ÁREA DE FERRAMENTAS (ADMIN) --- */
.admin-tools {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--glass-border);
    padding: 25px 0;
    margin-bottom: 30px;
    box-shadow: inset 0 -10px 20px -10px rgba(0,0,0,0.3);
}

.tools-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.tools-title {
    color: var(--text-secondary);
    margin: 0 0 15px 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.tools-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--glass-border), transparent); }

.tools-grid { display: flex; gap: 15px; flex-wrap: wrap; }

.btn-tool {
    border: none; padding: 12px 24px; border-radius: 8px;
    font-family: 'Lato', sans-serif; font-weight: 600; font-size: 0.9rem;
    cursor: pointer; display: flex; align-items: center; gap: 10px;
    transition: all 0.2s ease; color: white; box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-tool:hover { transform: translateY(-2px); filter: brightness(1.15); box-shadow: 0 6px 12px rgba(0,0,0,0.3); }

.btn-cal { background: linear-gradient(135deg, #0284c7, #0ea5e9); }
.btn-pdf { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.btn-session { background: linear-gradient(135deg, #b45309, #d97706); }

.session-picker-group {
    display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.2);
    padding: 5px 15px 5px 5px; border-radius: 10px; border: 1px solid var(--glass-border);
}
.date-input-dark {
    background: transparent; border: none; color: var(--text-secondary);
    padding: 8px; font-family: 'Lato', sans-serif; outline: none;
    color-scheme: dark; cursor: pointer;
}

/* --- 4. DESTAQUES (SCROLL HORIZONTAL) --- */
.featured-section { max-width: 1200px; margin: 0 auto 40px; padding: 0 20px; }
.featured-title {
    font-family: 'Cinzel', serif; color: var(--text-primary);
    border-left: 3px solid var(--gold); padding-left: 15px; margin-bottom: 20px; font-size: 1.3rem;
}

.upcoming-scroll {
    display: flex; gap: 20px; overflow-x: auto; padding: 10px 5px 20px;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}

.mini-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    min-width: 220px; padding: 20px; border-radius: 16px; border: 1px solid var(--glass-border);
    position: relative; overflow: hidden; scroll-snap-align: start; transition: transform 0.3s, border-color 0.3s;
}
.mini-card:hover { transform: translateY(-3px); border-color: var(--gold-dim); }
.mini-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%;
    background: var(--gold); box-shadow: 0 0 10px var(--gold);
}

.countdown-badge {
    font-size: 0.7rem; background: var(--gold); color: var(--bg-darker);
    padding: 3px 10px; border-radius: 12px; font-weight: 800;
    display: inline-block; margin-bottom: 10px; text-transform: uppercase;
}

/* --- 5. BUSCA STICKY (GRUDADA NO TOPO) --- */
.main-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.search-wrapper { 
    position: -webkit-sticky; position: sticky; 
    top: 85px; /* Ajuste conforme altura do header */
    z-index: 95;
    margin: 0 -20px 30px; padding: 15px 20px; 
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px); 
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
}

.search-wrapper input {
    width: 100%; padding: 15px 20px 15px 50px; 
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--glass-border); border-radius: 50px;
    color: white; font-size: 1rem; outline: none; transition: all 0.3s ease;
}
.search-wrapper input:focus {
    background: rgba(255,255,255,0.15); border-color: var(--gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2); transform: scale(1.01);
}
.search-icon {
    position: absolute; left: 40px; top: 50%; transform: translateY(-50%);
    color: var(--gold); font-size: 1.1rem; z-index: 96; pointer-events: none;
}

/* --- 6. GRID E CARDS --- */
.month-divider { display: flex; align-items: center; margin: 50px 0 25px; animation: fadeIn 0.8s ease-out; }
.month-divider h2 {
    font-family: 'Cinzel', serif; color: var(--gold); margin: 0 20px 0 0;
    font-size: 1.8rem; text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.month-line { flex-grow: 1; height: 1px; background: linear-gradient(90deg, var(--gold-dim), transparent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 25px; }

.card {
    background: var(--glass-bg); backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border); border-radius: 16px;
    padding: 25px; position: relative; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden; animation: fadeInUp 0.5s ease-out forwards; opacity: 0;
}
.card:hover {
    transform: translateY(-8px); box-shadow: var(--shadow-gold);
    border-color: rgba(212, 175, 55, 0.4); background: rgba(30, 41, 59, 0.85);
}
.card::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, var(--glass-shine), transparent);
    transform: skewX(-25deg); transition: 0.6s; pointer-events: none;
}
.card:hover::after { left: 150%; }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.date-circle {
    background: rgba(255,255,255,0.05); border: 1px solid var(--gold-dim); color: var(--gold);
    width: 55px; height: 55px; border-radius: 50%; display: flex; flex-direction: column;
    align-items: center; justify-content: center; line-height: 1; box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}
.date-day { font-size: 1.4rem; font-weight: 700; }
.date-month { font-size: 0.65rem; text-transform: uppercase; font-weight: 400; margin-top: 2px; }

.role-badge {
    padding: 6px 14px; border-radius: 30px; font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px; display: flex; align-items: center; gap: 6px;
}
.role-mason { background: var(--mason-bg); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.role-family { background: var(--family-bg); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); }

.card-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; color: white; line-height: 1.3; }
.card-connection {
    font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 25px; display: flex;
    align-items: center; gap: 8px; padding-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.card-connection strong { color: #cbd5e1; }

.btn-whatsapp {
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
    padding: 14px; border-radius: 12px; background: linear-gradient(135deg, #25D366, #059669);
    color: white; text-decoration: none; font-weight: 700; font-size: 0.95rem;
    transition: all 0.3s; box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.btn-whatsapp:hover { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4); }

/* --- 7. RODAPÉ --- */
.dashboard-footer {
    text-align: center; padding: 40px 20px; margin-top: 60px;
    border-top: 1px solid var(--glass-border); background: rgba(15, 23, 42, 0.95);
    color: var(--text-secondary); font-size: 0.85rem;
}

/* --- 8. BOTÕES FLUTUANTES (UNIFICADO) --- */
.btn-float {
    position: fixed; right: 25px; width: 55px; height: 55px;
    border: none; border-radius: 50%; font-size: 1.4rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 9999 !important; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 20px rgba(0,0,0,0.4); -webkit-backface-visibility: hidden;
}
.btn-float:hover { transform: translateY(-5px); filter: brightness(1.2); }

/* Botão Subir (Dourado) */
.btn-scroll-top {
    bottom: 30px; background: var(--gold); color: var(--bg-darker);
    opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.8);
}
.btn-scroll-top.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* Botão Mês Atual (Azul) */
.btn-jump-current {
    bottom: 30px; background: var(--mason-blue); color: white;
    border: 2px solid rgba(255,255,255,0.2);
    opacity: 1; visibility: visible; transform: translateY(0) scale(1);
    animation: pulse-blue 2s infinite;
}
.btn-jump-current.hide { opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.8); }

/* --- 9. KEYFRAMES --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* --- 10. RESPONSIVO --- */
@media (max-width: 768px) {
    .header-content { flex-direction: column; text-align: center; gap: 20px; }
    .stats-bar { width: 100%; justify-content: space-around; }
    .logo-section h1 { font-size: 1.4rem; }
    .month-divider h2 { font-size: 1.5rem; }
    .tools-grid { justify-content: center; }
    .search-wrapper { top: 110px; /* Ajuste para header mobile */ }
    .btn-float { right: 20px; width: 50px; height: 50px; font-size: 1.2rem; }
    .btn-scroll-top, .btn-jump-current { bottom: 25px; }
}