﻿/* ============================================================
   FFACILITES Admin - Polish Pro
   Cursor personalizado + refinamentos visuais futuristas.
   Carregado por ultimo para sobrescrever onde precisar.
   ============================================================ */

:root {
    --pro-primary: #d4a017;
    --pro-primary-light: #f5c518;
    --pro-cyan: #06b6d4;
    --pro-purple: #a855f7;
    --pro-glow: rgba(245,197,24,0.5);
}

/* Cursor customizado removido - usa o cursor padrao do sistema */
.cursor-dot, .cursor-ring { display: none !important; }

/* ============ FUNDO FUTURISTA ============ */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(212,160,23,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212,160,23,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.4), transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.4), transparent 70%);
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 100% 0%, rgba(212, 160, 23, 0.10), transparent 60%),
        radial-gradient(ellipse 500px 400px at 0% 100%, rgba(168, 85, 247, 0.08), transparent 60%),
        radial-gradient(ellipse 400px 400px at 50% 50%, rgba(6, 182, 212, 0.05), transparent 60%);
    pointer-events: none;
    z-index: 0;
}
.sidebar, .content { position: relative; z-index: 1; }

/* ============ SIDEBAR REFINADA ============ */
.sidebar {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(15, 15, 28, 0.85) !important;
    border-right: 1px solid rgba(212,160,23,0.12) !important;
}

.btn-nav {
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
}
.btn-nav::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px; height: 70%;
    background: linear-gradient(180deg, var(--pro-primary-light), var(--pro-primary));
    border-radius: 0 3px 3px 0;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-nav:hover::before, .btn-nav.active::before {
    transform: translateY(-50%) scaleY(1);
}
.btn-nav.active {
    background: linear-gradient(90deg, rgba(212,160,23,0.18), transparent 80%) !important;
}

/* ============ STAT CARDS GLOW ============ */
.stat-card {
    transition: all 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at top right, rgba(245,197,24,0.10), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(245,197,24,0.18);
}
.stat-card:hover::before { opacity: 1; }

/* Cor especial para a borda dos cards de estatistica */
.stat-card.verde::after,
.stat-card.vermelho::after,
.stat-card.roxo::after,
.stat-card.amarelo::after,
.stat-card.azul::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--corBorda, var(--pro-primary));
    opacity: 0.55;
}
.stat-card.verde { --corBorda: #10b981; }
.stat-card.vermelho { --corBorda: #ef4444; }
.stat-card.roxo { --corBorda: #a855f7; }
.stat-card.amarelo { --corBorda: #f5c518; }
.stat-card.azul { --corBorda: #3b82f6; }

.stat-card-icon {
    transition: transform 0.3s;
}
.stat-card:hover .stat-card-icon {
    transform: scale(1.08) rotate(-4deg);
}

/* ============ BLOCOS COM BACKDROP ============ */
.bloco {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: border-color 0.25s, box-shadow 0.25s;
}
.bloco:hover {
    border-color: rgba(245,197,24,0.18) !important;
}
.bloco-titulo {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
}
.bloco-titulo img {
    width: 18px;
    height: 18px;
    opacity: 0.9;
    filter: invert(1);
}

/* ============ BOTOES PREMIUM ============ */
.btn-primary, .btn-success, .btn-danger, .btn-ghost, .btn-warn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}
.btn-primary::after, .btn-success::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: translateX(-120%);
    transition: transform 0.5s;
}
.btn-primary:hover::after, .btn-success:hover::after {
    transform: translateX(120%);
}
.btn-primary:active, .btn-success:active, .btn-danger:active, .btn-ghost:active {
    transform: scale(0.97);
}

/* ============ TABELA AMIGAVEL ============ */
.tabela-admin tbody tr {
    transition: background 0.18s, transform 0.18s !important;
}
.tabela-admin tbody tr:hover {
    background: rgba(245,197,24,0.05) !important;
}

/* Status badges com glow */
.status-tag {
    position: relative;
    overflow: hidden;
}
.status-tag.ativo {
    box-shadow: 0 0 12px rgba(16,185,129,0.25);
}
.status-tag.expirado {
    box-shadow: 0 0 12px rgba(239,68,68,0.3);
}
.status-tag.pendente {
    box-shadow: 0 0 12px rgba(245,197,24,0.3);
}

/* ============ INPUTS REFINADOS ============ */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
    transition: all 0.22s !important;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="number"]:focus, input[type="date"]:focus, select:focus, textarea:focus {
    border-color: var(--pro-primary-light) !important;
    box-shadow: 0 0 0 3px rgba(245,197,24,0.18) !important;
}

/* ============ PAGE HEADER COM GRADIENTE ============ */
.page-title {
    background: linear-gradient(135deg, #fff 30%, var(--pro-primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* ============ CHART BARS ============ */
.chart-bars {
    transition: opacity 0.3s;
}
.chart-bars > div {
    transition: all 0.3s !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.chart-bars > div:hover {
    transform: scaleY(1.05);
    filter: brightness(1.15);
}

/* ============ TIMELINE PULSE ============ */
.timeline-item {
    position: relative;
    padding-left: 24px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pro-primary-light);
    box-shadow: 0 0 10px var(--pro-glow);
}
.timeline-item:first-child::before {
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 10px var(--pro-glow); }
    50% { box-shadow: 0 0 20px var(--pro-glow), 0 0 4px rgba(245,197,24,0.5); }
}

/* ============ ANIMACOES SUTIS ============ */
@keyframes admin-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.aba-content[style*="display:block"], .aba-content[style*="display: block"] {
    animation: admin-fade-in 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ BOTOES DA SIDEBAR FOOTER ============ */
.btn-site, .btn-logout {
    position: relative;
    overflow: hidden;
}
.btn-site::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, rgba(245,197,24,0.4), transparent 50%, rgba(245,197,24,0.4));
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}
.btn-site:hover::before { opacity: 1; }

/* ============ TOAST UPGRADE ============ */
.toast {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px !important;
    box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
}

/* ============ MOBILE ============ */
@media (max-width: 900px) {
    /* nada especial - cursor ja eh padrao */
}

/* ============ NAV BADGES PULSANTES ============ */
.nav-badge:not(.hidden) {
    animation: badge-pulse 2.5s ease-in-out infinite;
}
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
.nav-badge.vermelho:not(.hidden) {
    animation: badge-pulse-red 1.8s ease-in-out infinite;
}
@keyframes badge-pulse-red {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ============ LOGO AREA COM GLOW ============ */
.logo-area {
    position: relative;
}
.logo-area::after {
    content: '';
    position: absolute;
    bottom: 0; left: 24px; right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245,197,24,0.4), transparent);
}


/* ============================================================
   ADMIN MOBILE - hamburger + drawer + topbar
   ============================================================ */
.admin-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 90;
    background: rgba(10, 10, 20, 0.92);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid rgba(245, 197, 24, 0.18);
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.admin-topbar img.topbar-logo { height: 28px; }
.admin-topbar .topbar-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--pro-primary-light);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.admin-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    background: rgba(245, 197, 24, 0.10);
    border: 1px solid rgba(245, 197, 24, 0.3);
    border-radius: 10px;
    flex-shrink: 0;
    transition: all 0.2s;
    padding: 0;
}
.admin-hamburger:hover { background: rgba(245, 197, 24, 0.18); }
.admin-hamburger span {
    display: block;
    width: 18px; height: 2px;
    background: var(--pro-primary-light);
    border-radius: 2px;
    position: relative;
    transition: all 0.3s;
}
.admin-hamburger span::before,
.admin-hamburger span::after {
    content: '';
    position: absolute;
    left: 0; width: 18px; height: 2px;
    background: var(--pro-primary-light);
    border-radius: 2px;
    transition: all 0.3s;
}
.admin-hamburger span::before { top: -6px; }
.admin-hamburger span::after { top: 6px; }
.admin-hamburger.is-open span { background: transparent; }
.admin-hamburger.is-open span::before { top: 0; transform: rotate(45deg); }
.admin-hamburger.is-open span::after  { top: 0; transform: rotate(-45deg); }

.admin-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 110;
    opacity: 0;
    transition: opacity 0.3s;
}
.admin-backdrop.is-open {
    display: block;
    opacity: 1;
}

@media (max-width: 900px) {
    body { display: block !important; }

    .admin-topbar { display: flex; }

    .sidebar {
        position: fixed !important;
        top: 0; left: 0;
        width: min(86vw, 320px) !important;
        min-width: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
        transform: translateX(-100%);
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 120;
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.6);
        padding-top: max(12px, env(safe-area-inset-top)) !important;
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar .logo-area {
        padding-right: 60px;
        position: relative;
    }

    .content {
        padding: 18px 16px !important;
        margin-left: 0 !important;
    }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .stat-card { padding: 14px !important; }
    .stat-card-value { font-size: 22px !important; }
    .form-grid { grid-template-columns: 1fr !important; }
    .page-header-row { flex-direction: column; align-items: flex-start !important; gap: 10px; }

    /* Tabela: scroll horizontal interno */
    .bloco { overflow-x: auto; }
    .tabela-admin { min-width: 540px; white-space: nowrap; }
}

@media (max-width: 600px) {
    .admin-topbar .topbar-title { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr !important; }
    .stat-card-value { font-size: 20px !important; }
    .page-title { font-size: 22px !important; }
    .modal { padding: 22px 18px !important; }
}

@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr !important; }
}


/* BotÃ£o fechar drawer mobile (injetado via JS) */
.sidebar-close-mobile {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px; height: 34px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.18s;
    padding: 0;
}
.sidebar-close-mobile img {
    width: 14px; height: 14px;
    filter: invert(1) brightness(0.85);
}
.sidebar-close-mobile:hover {
    background: rgba(245, 197, 24, 0.12);
    border-color: rgba(245, 197, 24, 0.3);
}
.sidebar-close-mobile:hover img {
    filter: invert(72%) sepia(73%) saturate(450%) hue-rotate(2deg) brightness(102%);
}
@media (max-width: 900px) {
    .sidebar-close-mobile { display: inline-flex; }
}


/* ============================================================
   DASHBOARD V2 - blocos novos (receita por plano + badges)
   ============================================================ */

/* Grafico de receita por plano (barras horizontais) */
.chart-receita-plano {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 12px 0 4px;
}
.chart-rec-row {
    display: grid;
    grid-template-columns: 90px 1fr 100px;
    align-items: center;
    gap: 10px;
}
.chart-rec-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.chart-rec-bar-bg {
    height: 22px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.chart-rec-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
    min-width: 4px;
}
.chart-rec-val {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    text-align: right;
}

/* Badges de plano (Mensal/Trimestral/Vitalicio) */
.badge-plano {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
.badge-plano-mensal {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-plano-trimestral {
    background: rgba(245, 197, 24, 0.15);
    color: #f5c518;
    border: 1px solid rgba(245, 197, 24, 0.3);
}
.badge-plano-vitalicio {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Stats grid mais denso (12 cards) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
    gap: 12px !important;
}

@media (max-width: 1100px) {
    .chart-rec-row {
        grid-template-columns: 76px 1fr 84px;
    }
}
@media (max-width: 768px) {
    .chart-rec-row {
        grid-template-columns: 64px 1fr 70px;
        gap: 8px;
    }
    .chart-rec-label { font-size: 10.5px; }
    .chart-rec-val { font-size: 11px; }
}
