/* ==========================================================================
   CONFIGURAÇÃO DE TEMAS DINÂMICOS (MUDANÇA EM TEMPO REAL)
   ========================================================================== */

/* 1. PALETA PADRÃO: CLEAN MODE (LIGHT) */
:root {
    --accent-rgb: 78, 115, 223;
    --accent-color: rgb(var(--accent-rgb));
    --bs-btn-color: #212529;
    --bg-body: #f4f6f9;          /* Fundo claro para o modo Clean */
    --bg-sidebar: #ffffff;       /* Sidebar branca */
    --bg-card: #ffffff;          /* Cards brancos */
    --bg-input: #f1f3f7;         /* Inputs cinza claro */
    --bg-topbar: rgba(244, 246, 249, 0.8); /* Topbar translúcida clara */
    
    --text-main: #2d3748;        /* Texto escuro */
    --text-muted: #718096;       /* Texto auxiliar */
    --border-color: rgba(0, 0, 0, 0.06); /* Bordas suaves escuras */
}

/* 2. ALTERNÂNCIA AUTOMÁTICA: O QUE MUDA SE ESTIVER EM DARK MODE */
[data-bs-theme="dark"] {
    /* Paleta Dark Refinada (Estilo Dashcube) */
    --accent-color: #3791f8; /* Cor de destaque para o modo escuro */
    --bg-body: #1b1e2e;          
    --bg-sidebar: #22263d;       
    --bg-card: #252945;          
    --bg-input: #2e3354;
    --bg-topbar: rgba(27, 30, 46, 0.8); /* Topbar translúcida escura */
    --bs-btn-color: #fff!important;
    --text-main: #d1d5db;        
    --text-muted: #6b7280;
    --border-color: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   APLICAÇÃO DOS ESTILOS GERAIS (DINÂMICOS E ADAPTÁVEIS)
   ========================================================================== */

body {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
    font-family: var(--font-main);
    letter-spacing: -0.01em;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Forçar títulos a seguirem o tema de texto principal */
.card .h3, h1, h2, h3, h4, h5, h6 {
    color: var(--text-main) !important;
    transition: color 0.3s ease;
}

/* --- SIDEBAR REFINADA --- */
.sidebar {
    background-color: var(--bg-sidebar) !important;
    border-right: 1px solid var(--border-color);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.03);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar .nav-link {
    color: var(--text-muted) !important;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 12px 20px;
    margin: 4px 12px;
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    margin-right: 14px;
    opacity: 0.7;
}

.sidebar .nav-link:hover {
    color: var(--text-main) !important;
    background: rgba(255, 255, 255, 0.04);
}

/* Quando em modo light, o hover da sidebar ganha um fundo cinza sutil */
[data-bs-theme="light"] .sidebar .nav-link:hover {
    background: rgba(0, 0, 0, 0.03);
}

.sidebar .nav-link.active {
    color: #ffffff !important;
    background: var(--accent-color) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* --- TOPBAR TRANSPARENTE --- */
.topbar {
    background: var(--bg-topbar) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    height: 75px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- CARDS DE MÉTRICAS --- */
.card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08) !important;
}

.card .text-xs {
    color: var(--text-muted) !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card .h3 {
    color: var(--text-main) !important;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* --- TABELAS E INPUTS --- */
.table {
    color: var(--text-main) !important;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table thead th {
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 15px 20px;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

/* Fundo das linhas da tabela conforme o tema ativo */
[data-bs-theme="light"] .table tbody tr {
    background: rgba(0, 0, 0, 0.02) !important;
}
[data-bs-theme="dark"] .table tbody tr {
    background: rgba(255, 255, 255, 0.02) !important;
}

.table tbody td {
    border: none;
    padding: 18px 20px;
}

.table tbody tr td:first-child { border-radius: 12px 0 0 12px; }
.table tbody tr td:last-child { border-radius: 0 12px 12px 0; }

.event-tag { 
    font-size: 0.65rem; 
    padding: 4px 8px; 
    margin: 2px 4px; 
    border-radius: 4px; 
    display: block; 
    overflow: hidden; 
    white-space: normal; 
    text-overflow: ellipsis;
    font-weight: 600;
    border-left: 3px solid transparent;
}
.form-control, .form-select {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    border-radius: 10px;
    padding: 12px 15px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.15);
}

/* --- CORES DAS TAGS DE TATUADORES --- */
.tag-lua { background: rgba(171, 71, 188, 0.1); color: #ce93d8; border-left-color: #ab47bc; }
.tag-thierry { background: rgba(38, 166, 154, 0.1); color: #80cbc4; border-left-color: #26a69a; }
.tag-default { background: rgba(255,255,255,0.05); color: #ccc; border-left-color: #666; }

/* --- BOTÕES DE GRADE DE HORÁRIOS --- */
.btn-grade-disponivel {
    background-color: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #a0aab4 !important;
    font-size: 0.8rem;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.2s;
}
.btn-grade-disponivel:hover {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #10b981 !important;
}

/* --- ESTILOS DE LOGIN --- */
.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    padding: 2.5rem;
}
.btn-login {
    background-color: var(--accent-color);
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-login:hover {
    background-color: #2576d2;
    transform: translateY(-2px);
}

/* --- ESTILOS DE FORMULÁRIO DE TATUADOR (ajax_form_tatuador.php) --- */
#formSalvarTatuador .form-control, 
#formSalvarTatuador .form-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
#formSalvarTatuador .form-control:focus, 
#formSalvarTatuador .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(var(--accent-rgb), 0.1);
}

/* --- BADGES --- */
.badge-money {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 700;
}

/* --- CLIENTE DETALHES --- */
.card-detail { 
    background-color: var(--bg-card); 
    border: 1px solid var(--border-color); 
    color: var(--text-main); 
    border-radius: 16px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.2); 
}
.info-label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; margin-bottom: 2px; display: block; }
.info-value { font-weight: 600; color: var(--text-main); margin-bottom: 15px; display: block; }
.table-history thead th { background: rgba(255,255,255,0.02); color: #666; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.8rem; }
.badge-status { border-radius: 20px; padding: 4px 12px; font-weight: 600; font-size: 0.7rem; }
.border-custom { border-bottom: 1px solid rgba(255,255,255,0.05); }
hr { border-color: rgba(255,255,255,0.05); }
.text-dark {
    color: var(--text-main) !important;
}

img[alt="Logo"] {
    border-radius: 50px;
}

/* ==========================================================================
   REGRAS DE RESPONSIVIDADE (CELULARES E TABLETS)
   ========================================================================== */

@media (max-width: 767.98px) {
    .sidebar {
        min-height: auto !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
        background-color: var(--bg-sidebar) !important;
        position: relative;
        z-index: 1049;
    }

    .sidebar .nav-link {
        margin: 4px 0;
        padding: 10px 15px;
    }

    main {
        padding-top: 20px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Evita quebra de tabelas adicionando scroll horizontal */
    .table-responsive {
        border: none !important;
        margin-bottom: 1rem;
    }
    
    .table {
        min-width: 600px;
    }

    .sidebar .topbar {
        height: auto !important;
        padding: 10px 0 !important;
        background: transparent !important;
        border: none !important;
    }
    
    .sidebar .topbar .navbar-nav {
        flex-direction: row !important;
        justify-content: space-between;
        width: 100%;
    }

    .card {
        margin-bottom: 15px;
    }
    
    .card .h3 {
        font-size: 1.5rem !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar .nav-link {
        font-size: 0.8rem;
        padding: 10px 8px;
        margin: 4px 4px;
    }
    .sidebar .nav-link i {
        margin-right: 8px;
    }
}

.btn-outline-dark{
    color:var(--text-main);
}