/* ============================================================
   ADMIN.CSS — AGUIAS DE CRISTO | Pizza Camp
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

        :root {
            --bg:      #0a0e17;
            --bg2:     #060911;
            --glass:   rgba(255,255,255,0.05);
            --border:  rgba(255,255,255,0.08);
            --blue:    #3b82f6;
            --green:   #10b981;
            --nav-h:   64px;
        }

        html { height: 100%; }

        body {
            font-family: 'Inter', sans-serif;
            background: var(--bg);
            color: white;
            height: 100%;
            -webkit-tap-highlight-color: transparent;
        }

        ::-webkit-scrollbar { width: 4px; }
        ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }

        .glass {
            background: var(--glass);
            border: 1px solid var(--border);
            border-radius: 1.25rem;
            backdrop-filter: blur(12px);
        }

        /* ── LOGIN ── usa display puro, sem Tailwind */
        #loginOverlay {
            position: fixed; inset: 0; z-index: 200;
            display: flex; align-items: center; justify-content: center;
            padding: 1.25rem; background: #060911;
        }

        /* ── DASHBOARD ── */
        #mainDashboard {
            display: flex; width: 100%; height: 100dvh;
            opacity: 0; transition: opacity .5s ease;
        }

        /* ── SIDEBAR ── */
        #sidebar {
            width: 220px; min-width: 220px;
            background: var(--bg2);
            border-right: 1px solid var(--border);
            display: flex; flex-direction: column;
            padding: 1.5rem 1rem; gap: .375rem; overflow-y: auto;
        }
        .snav-btn {
            display: flex; align-items: center; gap: 10px;
            padding: 11px 14px; border-radius: 12px;
            border: none; background: transparent; color: #6b7280;
            font-size: 13px; font-weight: 600; cursor: pointer;
            width: 100%; text-align: left; transition: all .2s;
            text-decoration: none; font-family: inherit;
        }
        .snav-btn:hover  { background: rgba(255,255,255,0.05); color: white; }
        .snav-btn.active { background: rgba(59,130,246,.12); color: var(--blue); border-right: 3px solid var(--blue); }
        .snav-btn.store  { color: var(--green); border: 1px solid rgba(16,185,129,.2); }
        .snav-btn.store:hover { background: rgba(16,185,129,.08); }

        /* ── CONTEÚDO ── */
        #main-content { flex: 1; min-width: 0; overflow-y: auto; padding: 2rem; }

        /* ── SEÇÕES ── */
        .section { display: none; }
        .section.active { display: block; animation: fadeUp .25s ease; }
        @keyframes fadeUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

        /* ── KPI ── */
        .kpi-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .75rem; margin-bottom: 1.25rem; }
        .kpi-card { background: var(--glass); border: 1px solid var(--border); border-radius: 1rem; padding: 1rem 1.1rem; min-width: 0; }
        .kpi-label { font-size: 9px; font-weight: 800; color: #6b7280; text-transform: uppercase; letter-spacing: .06em; }
        .kpi-value { font-size: 1.4rem; font-weight: 900; margin-top: .2rem; line-height: 1.2; word-break: break-word; }
        .kpi-sub   { font-size: 9px; color: #4b5563; margin-top: .2rem; }

        /* ── CARDS GENÉRICOS ── */
        .item-card { background: var(--glass); border: 1px solid var(--border); border-radius: 1rem; padding: 1rem 1.1rem; margin-bottom: .75rem; }

        /* ── BADGES ── */
        .badge { display: inline-block; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; }
        .badge-pago     { background: rgba(16,185,129,.15); color: #34d399; }
        .badge-pendente  { background: rgba(234,179,8,.15);  color: #facc15; }
        .badge-confirmado { background: rgba(59,130,246,.15); color: #60a5fa; }

        /* ── BOTTOM NAV ── */
        #bottom-nav {
            display: none; position: fixed; bottom: 0; left: 0; right: 0;
            height: var(--nav-h); background: rgba(6,9,17,.97);
            border-top: 1px solid var(--border);
            backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
            z-index: 90; padding-bottom: env(safe-area-inset-bottom, 0px);
        }
        #bottom-nav .bnav-inner { display: flex; width: 100%; height: 100%; }
        .bnav-btn {
            flex: 1 1 0; display: flex; flex-direction: column;
            align-items: center; justify-content: center; gap: 3px;
            color: #6b7280; font-size: 9px; font-weight: 800;
            text-transform: uppercase; letter-spacing: .04em;
            border: none; background: transparent; cursor: pointer;
            padding: 4px 2px; transition: color .2s, background .2s;
            text-decoration: none; min-width: 0; font-family: inherit;
        }
        .bnav-btn i { font-size: 17px; display: block; }
        .bnav-btn span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; text-align: center; padding: 0 2px; }
        .bnav-btn.active    { color: var(--blue); background: rgba(59,130,246,.08); }
        .bnav-btn.store-btn { color: var(--green); }
        .bnav-btn.logout-btn { color: #9ca3af; }

        /* ── MODAL ── */
        .modal-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,.82);
            backdrop-filter: blur(8px); display: none;
            align-items: center; justify-content: center; z-index: 110; padding: 1rem;
        }
        .modal-box { background: #111827; border: 1px solid rgba(59,130,246,.25); border-radius: 1.5rem; padding: 2rem; width: 100%; max-width: 420px; }
        .modal-input {
            width: 100%; padding: 14px 16px; border-radius: 12px;
            background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
            color: white; font-size: 15px; outline: none; transition: border .2s;
            font-family: inherit; margin-bottom: .875rem;
        }
        .modal-input:focus { border-color: var(--blue); }
        .modal-input::placeholder { color: #4b5563; }

        /* ── RELATÓRIOS ── */
        .filter-bar {
            background: var(--glass); border: 1px solid var(--border); border-radius: 1.25rem;
            padding: 1.25rem; margin-bottom: 1.25rem;
            display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
        }
        .filter-group { display: flex; flex-direction: column; gap: .375rem; flex: 1; min-width: 130px; }
        .filter-label { font-size: 9px; font-weight: 800; color: #6b7280; text-transform: uppercase; letter-spacing: .06em; }
        .filter-select, .filter-input {
            padding: 10px 14px; border-radius: 10px;
            background: #1a2035; border: 1px solid rgba(255,255,255,.15);
            color: white; font-size: 13px; font-family: inherit; outline: none;
            -webkit-appearance: none; appearance: none;
        }
        .filter-select {
            cursor: pointer;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            padding-right: 36px;
        }
        .filter-select option {
            background: #1a2035;
            color: white;
        }
        .filter-select option:checked {
            background: #2563eb;
            color: white;
        }
        .filter-select:focus, .filter-input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(59,130,246,.2); }

        .btn-blue {
            padding: 10px 20px; border-radius: 10px; background: var(--blue);
            color: white; font-weight: 800; font-size: 13px; border: none;
            cursor: pointer; font-family: inherit; transition: background .2s; white-space: nowrap;
        }
        .btn-blue:hover { background: #2563eb; }

        .rel-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .75rem; margin-bottom: 1.25rem; }
        .rel-card { background: var(--glass); border: 1px solid var(--border); border-radius: 1rem; padding: 1.1rem 1.25rem; min-width: 0; }
        .rel-title { font-size: 9px; font-weight: 800; color: #6b7280; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .375rem; }
        .rel-value { font-size: 1.5rem; font-weight: 900; line-height: 1.2; word-break: break-word; }
        .rel-sub   { font-size: 9px; color: #4b5563; margin-top: .25rem; }

        .tabela-rel { width: 100%; border-collapse: collapse; font-size: 13px; }
        .tabela-rel th { padding: .625rem .75rem; text-align: left; font-size: 9px; font-weight: 800; color: #6b7280; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
        .tabela-rel td { padding: .75rem .75rem; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
        .tabela-rel tr:last-child td { border-bottom: none; }
        .tabela-rel tr:hover td { background: rgba(255,255,255,.025); }

        /* ── UPLOAD DE IMAGEM ── */
        .upload-area {
            border: 2px dashed rgba(255,255,255,.15);
            border-radius: 12px;
            padding: 1.25rem;
            text-align: center;
            cursor: pointer;
            transition: all .2s;
            margin-bottom: .875rem;
            position: relative;
        }
        .upload-area:hover { border-color: var(--blue); background: rgba(59,130,246,.06); }
        .upload-area.has-preview { border-style: solid; border-color: var(--green); background: rgba(16,185,129,.06); }
        .upload-area input[type=file] { display: none; }
        .upload-preview {
            width: 80px; height: 80px; border-radius: 10px;
            object-fit: cover; margin: 0 auto .625rem; display: none;
        }
        .upload-area.has-preview .upload-preview { display: block; }
        .upload-area.has-preview .upload-placeholder { display: none; }
        .upload-loading {
            display: none; position: absolute; inset: 0;
            background: rgba(10,14,23,.7); border-radius: 10px;
            align-items: center; justify-content: center; font-size: 12px;
            font-weight: 700; color: #60a5fa;
        }
        .upload-loading.active { display: flex; }

        /* ── MODAL CONFIRMAÇÃO EXCLUSÃO ── */
        #modalConfirmDelete {
            position: fixed; inset: 0; z-index: 300;
            background: rgba(0,0,0,.85); backdrop-filter: blur(8px);
            display: none; align-items: center; justify-content: center; padding: 1rem;
        }
        .confirm-box {
            background: #111827; border: 1px solid rgba(239,68,68,.35);
            border-radius: 1.5rem; padding: 2rem; width: 100%; max-width: 380px;
            text-align: center; animation: fadeUp .2s ease;
        }
        .confirm-icon {
            width: 60px; height: 60px; border-radius: 50%;
            background: rgba(239,68,68,.12); display: flex; align-items: center;
            justify-content: center; margin: 0 auto 1rem; font-size: 1.5rem; color: #f87171;
        }
        .confirm-title { font-size: 1.1rem; font-weight: 900; margin-bottom: .5rem; }
        .confirm-desc  { font-size: 12px; color: #9ca3af; line-height: 1.5; margin-bottom: 1.5rem; }
        .confirm-btns  { display: flex; gap: .75rem; }
        .btn-confirm-delete {
            flex: 1; padding: .875rem; border-radius: 12px;
            background: #dc2626; color: white; font-weight: 900; font-size: 13px;
            border: none; cursor: pointer; font-family: inherit; transition: background .2s;
        }
        .btn-confirm-delete:hover { background: #ef4444; }
        .btn-confirm-cancel {
            flex: 1; padding: .875rem; border-radius: 12px;
            background: rgba(255,255,255,.06); color: #9ca3af; font-weight: 900;
            font-size: 13px; border: none; cursor: pointer; font-family: inherit;
        }

        /* ── RESPONSIVO ── */
        @media (max-width: 767px) {
            #sidebar { display: none; }
            #bottom-nav { display: flex; }
            body { overflow: hidden; }
            #mainDashboard { display: flex; flex-direction: column; overflow: hidden; height: 100dvh; }
            #main-content {
                padding: 1rem .875rem;
                padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom,0px) + .75rem);
                flex: 1;
                overflow-y: auto;
                overflow-x: hidden;
                -webkit-overflow-scrolling: touch;
                height: 100%;
            }
            .kpi-value { font-size: 1.2rem; }
            .rel-value { font-size: 1.2rem; }
            .filter-bar { gap: .625rem; }
            .tabela-rel { font-size: 11px; }
            .tabela-rel th, .tabela-rel td { padding: .5rem .5rem; }
        }
        @media (min-width: 768px) {
            .kpi-grid { grid-template-columns: repeat(4,1fr); }
            .rel-grid  { grid-template-columns: repeat(4,1fr); }
        }

        /* ── GRÁFICOS LADO A LADO — DASHBOARD ── */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
    align-items: stretch;
}
.chart-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.chart-card-title {
    font-size: 10px;
    font-weight: 800;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .875rem;
}
.chart-canvas-wrap {
    position: relative;
    width: 100%;
    flex: 1;
    height: clamp(200px, 28vw, 260px);
}
.chart-canvas-wrap--tall {
    height: clamp(240px, 34vw, 320px);
}

/* Cabeçalho do card com botão de ajuda ao lado do título */
.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .875rem;
}
.chart-card-header .chart-card-title { margin-bottom: 0; }

.chart-help-btn {
    width: 20px; height: 20px; border-radius: 50%;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
    color: #9ca3af; font-size: 11px; font-weight: 800;
    cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: inherit; transition: all .2s; line-height: 1;
}
.chart-help-btn:hover { background: rgba(59,130,246,.15); color: #60a5fa; border-color: rgba(59,130,246,.3); }

.chart-help-box {
    display: none;
    font-size: 11px; color: #9ca3af; line-height: 1.5;
    background: rgba(59,130,246,.06); border: 1px solid rgba(59,130,246,.15);
    border-radius: 10px; padding: .625rem .75rem; margin-bottom: .875rem;
}
.chart-help-box.open { display: block; animation: fadeUp .2s ease; }

/* Mobile/Tablet: empilha verticalmente */
@media (max-width: 900px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
    .chart-canvas-wrap {
        height: clamp(180px, 55vw, 240px);
    }
    .chart-canvas-wrap--tall {
        height: clamp(220px, 60vw, 280px);
    }
}
