/**
 * Detetive.ia.br — Tema Dark/Glass sobre Bootstrap 5.3
 * Mapeia todas as cores, fontes e efeitos do index.html original
 *
 * @package DetetiveIA
 */

/* ─── CSS Variables (cores do index.html) ─────────────────── */
:root {
    --cyan-primary: #8aebff;
    --cyan-dark: #22d3ee;
    --cyan-glow: rgba(138, 235, 255, 0.5);
    --bg-background: #0b1326;
    --bg-surface: #0b1326;
    --bg-surface-container: #171f33;
    --bg-surface-container-high: #222a3d;
    --bg-surface-container-highest: #2d3449;
    --bg-surface-container-low: #131b2e;
    --bg-surface-container-lowest: #060e20;
    --bg-surface-bright: #31394d;
    --bg-surface-glass: rgba(30, 41, 59, 0.7);
    --text-primary: #F4F5FF;
    --text-on-surface: #dae2fd;
    --text-on-surface-variant: #bbc9cd;
    --text-muted: #727586;
    --border-subtle: rgba(244, 245, 255, 0.1);
    --border-primary: rgba(138, 235, 255, 0.1);
    --border-primary-hover: rgba(138, 235, 255, 0.4);
    --blue-secondary: #adc6ff;
    --error: #ffb4ab;
    --error-container: #93000a;
    --on-primary-fixed: #001f25;
    --primary-fixed-dim: #2fd9f4;
    --secondary-container: #0566d9;
}

/* ─── Base ────────────────────────────────────────────────── */
body {
    background-color: var(--bg-background) !important;
    color: var(--text-on-surface);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
}

::selection {
    background: rgba(138, 235, 255, 0.3);
}

/* ─── Typography ──────────────────────────────────────────── */
.font-dm {
    font-family: 'DM Sans', sans-serif;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
}

.letter-spacing-wide {
    letter-spacing: 0.05em;
}

/* ─── Colors ──────────────────────────────────────────────── */
.text-primary-cyan {
    color: var(--cyan-primary) !important;
}

.text-muted-custom {
    color: var(--text-muted) !important;
}

.text-on-surface {
    color: var(--text-on-surface) !important;
}

.text-on-surface-variant {
    color: var(--text-on-surface-variant) !important;
}

.text-glow {
    text-shadow: 0 0 15px var(--cyan-glow);
}

.bg-surface-dark {
    background-color: var(--bg-background) !important;
}

.bg-surface-container {
    background-color: var(--bg-surface-container) !important;
}

.bg-surface-container-high {
    background-color: var(--bg-surface-container-high) !important;
}

.bg-surface-container-lowest {
    background-color: var(--bg-surface-container-lowest) !important;
}

.bg-cyan-subtle {
    background-color: rgba(138, 235, 255, 0.1) !important;
}

.bg-primary-cyan-subtle {
    background-color: rgba(138, 235, 255, 0.15) !important;
}

.text-danger-subtle {
    color: var(--error) !important;
}

.border-subtle {
    border-color: var(--border-subtle) !important;
}

/* ─── Navigation (Glass — idêntico ao index.html) ─────────── */
.nav-glass {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 0;
    transition: padding 0.3s ease, box-shadow 0.3s ease;
}

.nav-glass.nav-scrolled {
    padding: 0.5rem 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.nav-link-custom {
    color: var(--text-on-surface-variant) !important;
    font-size: 16px;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link-custom:hover,
.nav-link-custom.active {
    color: var(--cyan-primary) !important;
}

.nav-link-custom.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--cyan-primary);
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn-cyan {
    background-color: var(--cyan-primary);
    color: var(--on-primary-fixed);
    border: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-cyan:hover {
    background-color: var(--cyan-dark);
    color: var(--on-primary-fixed);
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-cyan:active {
    transform: scale(0.95);
}

.btn-outline-cyan {
    border: 2px solid var(--cyan-primary);
    color: var(--cyan-primary);
    background: transparent;
    transition: all 0.3s ease;
}

.btn-outline-cyan:hover {
    background: rgba(138, 235, 255, 0.1);
    color: var(--cyan-primary);
    border-color: var(--cyan-primary);
}

.btn-outline-cyan:active {
    transform: scale(0.95);
}

.btn-glass {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.btn-glass:hover {
    border-color: var(--border-primary-hover);
    color: var(--cyan-primary);
}

/* ─── Glass Card ──────────────────────────────────────────── */
.glass-card {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-primary);
    border-radius: 1rem;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.glass-card:hover {
    border-color: var(--border-primary-hover);
}

.glass-card-hover:hover {
    transform: translateY(-4px);
}

/* ─── Forms (Dark Theme) ──────────────────────────────────── */
.form-control,
.form-select {
    background-color: var(--bg-surface-container) !important;
    border: 1px solid var(--border-subtle) !important;
    color: var(--text-primary) !important;
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--cyan-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(138, 235, 255, 0.15) !important;
    background-color: var(--bg-surface-container-high) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
}

.form-label {
    color: var(--text-on-surface-variant);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

.form-check-input {
    background-color: var(--bg-surface-container) !important;
    border-color: var(--border-subtle) !important;
}

.form-check-input:checked {
    background-color: var(--cyan-primary) !important;
    border-color: var(--cyan-primary) !important;
}

.form-check-label {
    color: var(--text-on-surface-variant);
}

.form-text {
    color: var(--text-muted) !important;
}

.input-group-text {
    background-color: var(--bg-surface-container-high) !important;
    border: 1px solid var(--border-subtle) !important;
    color: var(--text-muted) !important;
}

/* Invalid state */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--error) !important;
}

.invalid-feedback {
    color: var(--error);
    font-size: 0.8rem;
}

/* ─── Password Strength Indicator ─────────────────────────── */
.password-strength {
    height: 4px;
    border-radius: 4px;
    background: var(--bg-surface-container-high);
    overflow: hidden;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
}

.password-strength-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease, background-color 0.4s ease;
    width: 0%;
}

.password-strength-bar.weak { width: 25%; background: #ef4444; }
.password-strength-bar.fair { width: 50%; background: #f59e0b; }
.password-strength-bar.good { width: 75%; background: #3b82f6; }
.password-strength-bar.strong { width: 100%; background: #22c55e; }

.password-strength-text {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    transition: color 0.3s ease;
}

/* ─── Drag and Drop Area ──────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border-subtle);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-surface-container);
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--cyan-primary);
    background: rgba(138, 235, 255, 0.05);
}

.drop-zone .material-symbols-outlined {
    font-size: 48px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.drop-zone:hover .material-symbols-outlined,
.drop-zone.dragover .material-symbols-outlined {
    color: var(--cyan-primary);
}

.drop-zone-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 0.75rem;
    object-fit: cover;
    margin-top: 1rem;
    border: 2px solid var(--border-primary);
}

/* ─── Cards (Stats) ───────────────────────────────────────── */
.stat-card {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--border-primary-hover);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(138, 235, 255, 0.1);
    border: 1px solid rgba(138, 235, 255, 0.2);
}

.stat-card .stat-value {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ─── Tables ──────────────────────────────────────────────── */
.table-dark-custom {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-on-surface);
    --bs-table-border-color: var(--border-subtle);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-hover-bg: rgba(138, 235, 255, 0.05);
}

.table-dark-custom thead th {
    background: var(--bg-surface-container-high);
    color: var(--text-on-surface-variant);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-subtle);
    padding: 0.875rem 1rem;
}

.table-dark-custom tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    font-size: 0.9rem;
}

/* ─── Badge / Status ──────────────────────────────────────── */
.badge-status {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-weight: 600;
}

.badge-ativo { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.badge-inativo { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-bloqueado { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-pendente { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }

/* ─── Pagination ──────────────────────────────────────────── */
.page-link {
    background: var(--bg-surface-container) !important;
    border-color: var(--border-subtle) !important;
    color: var(--text-on-surface-variant) !important;
}

.page-link:hover {
    background: var(--bg-surface-container-high) !important;
    color: var(--cyan-primary) !important;
}

.page-item.active .page-link {
    background: var(--cyan-primary) !important;
    border-color: var(--cyan-primary) !important;
    color: var(--on-primary-fixed) !important;
}

/* ─── Modal ───────────────────────────────────────────────── */
.modal-content {
    background: var(--bg-surface-container) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 1rem;
}

.modal-header {
    border-bottom-color: var(--border-subtle) !important;
}

.modal-footer {
    border-top-color: var(--border-subtle) !important;
}

.modal-title {
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
}

/* ─── Toast ───────────────────────────────────────────────── */
.toast {
    background: var(--bg-surface-container-high) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 0.75rem;
    color: var(--text-primary) !important;
}

.toast.toast-success { border-left: 4px solid #22c55e !important; }
.toast.toast-error { border-left: 4px solid #ef4444 !important; }
.toast.toast-warning { border-left: 4px solid #f59e0b !important; }
.toast.toast-info { border-left: 4px solid var(--cyan-primary) !important; }

/* ─── Admin Sidebar ───────────────────────────────────────── */
.admin-body {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: var(--bg-surface-container-low);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-on-surface-variant);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: rgba(138, 235, 255, 0.08);
    color: var(--cyan-primary);
}

.sidebar-link.active {
    background: rgba(138, 235, 255, 0.12);
    color: var(--cyan-primary);
    font-weight: 600;
}

.sidebar-link .material-symbols-outlined {
    font-size: 20px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 0.75rem 0;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.admin-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-surface-container);
    border-bottom: 1px solid var(--border-subtle);
}

.admin-page-content {
    padding: 2rem;
}

.avatar-sm {
    width: 36px;
    height: 36px;
}

/* ─── Dashboard Sidebar (Detetive Panel) ──────────────────── */
.panel-sidebar {
    background: var(--bg-surface-container-low);
    border-right: 1px solid var(--border-subtle);
    min-height: calc(100vh - 76px);
    padding: 2rem 1rem;
}

.panel-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-on-surface-variant);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.panel-sidebar-link:hover {
    background: rgba(138, 235, 255, 0.08);
    color: var(--cyan-primary);
}

.panel-sidebar-link.active {
    background: rgba(138, 235, 255, 0.12);
    color: var(--cyan-primary);
    font-weight: 600;
}

/* ─── Pulse Animation ─────────────────────────────────────── */
.pulse-dot {
    animation: pulse-anim 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-anim {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* ─── Hero Gradient ───────────────────────────────────────── */
.hero-gradient {
    background: radial-gradient(circle at top right, rgba(47, 217, 244, 0.1), transparent);
}

/* ─── Loading / Spinner ───────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 19, 38, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner-cyan {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(138, 235, 255, 0.2);
    border-top-color: var(--cyan-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Main Content ────────────────────────────────────────── */
.main-content {
    padding-top: 80px;
    min-height: calc(100vh - 100px);
}

/* ─── Misc ────────────────────────────────────────────────── */
.hover-text-white:hover {
    color: var(--text-primary) !important;
}

.bg-gradient-cyan {
    background: linear-gradient(135deg, var(--cyan-primary), var(--cyan-dark));
}

.section-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
}

.card-outline-cyan {
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.card-outline-cyan:hover,
.card-outline-cyan.selected {
    border-color: var(--cyan-primary);
}

.avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-primary);
}

.avatar-xl {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--cyan-primary);
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-content {
        margin-left: 0;
    }

    .admin-page-content {
        padding: 1rem;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
    }

    .admin-sidebar.show ~ .admin-content .sidebar-overlay,
    .admin-sidebar.show + .admin-content .sidebar-overlay {
        display: block;
    }

    .panel-sidebar {
        display: none;
    }

    .stat-card .stat-value {
        font-size: 1.35rem;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding-top: 70px;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
}

/* ─── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface-container-low);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface-container-highest);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(138, 235, 255, 0.3);
}

/* ─── Planos Cards ────────────────────────────────────────── */
.plano-card {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    border: 2px solid var(--border-subtle);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.plano-card:hover,
.plano-card.selected {
    border-color: var(--cyan-primary);
    transform: translateY(-4px);
}

.plano-card.destaque {
    border-color: rgba(138, 235, 255, 0.3);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(138, 235, 255, 0.05));
}

.plano-card .plano-price {
    font-family: 'DM Sans', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--cyan-primary);
}

.plano-card .plano-name {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

/* ─── Accordion ───────────────────────────────────────────── */
.accordion-button {
    background-color: var(--bg-surface-container) !important;
    color: var(--text-primary) !important;
    border: none;
    box-shadow: none !important;
}

.accordion-button:not(.collapsed) {
    background-color: var(--bg-surface-container-high) !important;
    color: var(--cyan-primary) !important;
}

.accordion-body {
    background-color: var(--bg-surface-container) !important;
    color: var(--text-on-surface-variant);
}
