/* ============================================
   DM SOLUÇÕES ADMINISTRATIVA - ESTILOS GLOBAIS
   ============================================ */

/* --- RESET --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* --- VARIÁVEIS DE CORES (Identidade DM) --- */
:root {
    /* Cores principais */
    --azul-escuro: #0a2a5e;
    --azul-medio: #1a4b8c;
    --azul-claro: #4da6ff;
    --azul-bg: #e8f0fe;
    
    /* Cores neutras */
    --branco: #ffffff;
    --cinza-50: #f8fafc;
    --cinza-100: #f1f5f9;
    --cinza-200: #e2e8f0;
    --cinza-300: #cbd5e1;
    --cinza-500: #64748b;
    --cinza-700: #334155;
    --cinza-900: #0f172a;
    
    /* Cores de status */
    --sucesso: #10b981;
    --aviso: #f59e0b;
    --erro: #ef4444;
    --info: #3b82f6;
    
    /* Sistema */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius: 12px;
    --radius-sm: 8px;
    --sombra-sm: 0 1px 3px rgba(0,0,0,0.08);
    --sombra: 0 4px 12px rgba(0,0,0,0.08);
    --sombra-lg: 0 10px 30px rgba(0,0,0,0.12);
    --transicao: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Fontes */
    --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- TEMA ESCURO --- */
[data-theme="dark"] {
    --branco: #1e293b;
    --cinza-50: #0f172a;
    --cinza-100: #1e293b;
    --cinza-200: #334155;
    --cinza-300: #475569;
    --cinza-500: #94a3b8;
    --cinza-700: #cbd5e1;
    --cinza-900: #f1f5f9;
    --azul-bg: #1e293b;
}

/* --- BASE --- */
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-base);
    background: var(--cinza-50);
    color: var(--cinza-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* --- SCROLLBAR PERSONALIZADA --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--cinza-300);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--cinza-500); }

/* ============================================
   COMPONENTES REUTILIZÁVEIS
   ============================================ */

/* --- BOTÕES --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    transition: var(--transicao);
    white-space: nowrap;
    border: 2px solid transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--sombra); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--azul-medio); color: white; }
.btn-primary:hover { background: var(--azul-escuro); }

.btn-success { background: var(--sucesso); color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--erro); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-outline {
    background: transparent;
    border-color: var(--cinza-300);
    color: var(--cinza-700);
}
.btn-outline:hover { border-color: var(--azul-medio); color: var(--azul-medio); }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: var(--cinza-100);
    color: var(--cinza-700);
}
.btn-icon:hover { background: var(--azul-bg); color: var(--azul-medio); }

/* --- CARDS --- */
.card {
    background: var(--branco);
    border-radius: var(--radius);
    box-shadow: var(--sombra-sm);
    padding: 24px;
    transition: var(--transicao);
    border: 1px solid var(--cinza-200);
}
.card:hover { box-shadow: var(--sombra); }

/* --- INPUTS --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}
.form-group label {
    font-weight: 600;
    font-size: 13px;
    color: var(--cinza-700);
    display: flex;
    align-items: center;
    gap: 6px;
}
.form-group label .obrigatorio { color: var(--erro); }

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--cinza-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--branco);
    color: var(--cinza-900);
    transition: var(--transicao);
}
.form-control:focus {
    outline: none;
    border-color: var(--azul-medio);
    box-shadow: 0 0 0 4px rgba(26, 75, 140, 0.1);
}
.form-control::placeholder { color: var(--cinza-500); }

/* --- BADGES --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* --- TOASTS (Notificações) --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--branco);
    border-radius: var(--radius-sm);
    box-shadow: var(--sombra-lg);
    border-left: 4px solid var(--info);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}
.toast.success { border-color: var(--sucesso); }
.toast.error { border-color: var(--erro); }
.toast.warning { border-color: var(--aviso); }
.toast i { font-size: 20px; }
.toast.success i { color: var(--sucesso); }
.toast.error i { color: var(--erro); }
.toast.warning i { color: var(--aviso); }

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-overlay.ativo { display: flex; animation: fadeIn 0.2s; }

.modal {
    background: var(--branco);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--sombra-lg);
    animation: modalIn 0.3s ease;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--cinza-200);
}
.modal-header h3 { font-size: 18px; color: var(--azul-escuro); }
.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--cinza-200);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- TABELAS --- */
.tabela-container { overflow-x: auto; border-radius: var(--radius); }
.tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.tabela thead {
    background: var(--azul-bg);
}
.tabela th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--azul-escuro);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tabela td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--cinza-200);
    color: var(--cinza-700);
}
.tabela tbody tr { transition: var(--transicao); }
.tabela tbody tr:hover { background: var(--cinza-50); }

/* --- EMPTY STATE --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--cinza-500);
}
.empty-state i {
    font-size: 64px;
    color: var(--cinza-300);
    margin-bottom: 16px;
}
.empty-state h3 { color: var(--cinza-700); margin-bottom: 8px; }

/* --- LOADER --- */
.loader {
    width: 40px;
    height: 40px;
    border: 4px solid var(--cinza-200);
    border-top-color: var(--azul-medio);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- ANIMAÇÕES --- */
.fade-in { animation: fadeIn 0.4s ease; }
.slide-up { animation: slideUp 0.4s ease; }
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}