@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&display=swap');

/* ==============================
   DESIGN SYSTEM - webTHI SaaS
============================== */
:root {
    --primary: #0047ff;
    --primary-dark: #0036cc;
    --primary-light: #e8efff;
    --secondary: #f8fafc;
    --dark: #0f172a;
    --dark-2: #1e293b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg-gradient: linear-gradient(135deg, #0047ff 0%, #0ea5e9 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.10);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.14);
    --radius: 16px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--secondary);
    color: var(--text);
    line-height: 1.6;
}

/* ==============================
   LAYOUT
============================== */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--dark);
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-logo {
    padding: 28px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo img { height: 36px; filter: brightness(0) invert(1); }
.sidebar-logo p { color: rgba(255,255,255,0.4); font-size: 0.7rem; letter-spacing: 2px; text-transform: uppercase; margin-top: 6px; }

.sidebar-nav { padding: 20px 16px; flex: 1; }

.nav-label {
    color: rgba(255,255,255,0.25);
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 12px 8px 8px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.nav-item:hover { background: rgba(255,255,255,0.07); color: white; }
.nav-item.active { background: var(--primary); color: white; box-shadow: 0 4px 15px rgba(0,71,255,0.4); }
.nav-item.danger { color: rgba(239,68,68,0.7); }
.nav-item.danger:hover { background: rgba(239,68,68,0.15); color: #ef4444; }

.main-content {
    margin-left: 260px;
    padding: 40px;
    min-height: 100vh;
}

/* ==============================
   CARDS & CONTAINERS
============================== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 28px;
}

.stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary);
}

.stat-card .icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    color: var(--primary);
}

.stat-value { font-size: 2.2rem; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* ==============================
   PAGE HEADER
============================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
.page-header h1 { font-size: 1.7rem; font-weight: 800; color: var(--dark); }
.page-header p { color: var(--text-muted); margin-top: 2px; font-size: 0.95rem; }

/* ==============================
   BOTÕES
============================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
    font-family: 'Outfit', sans-serif;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,71,255,0.35); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(0.9); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-outline { background: white; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius); }

/* ==============================
   TABELAS
============================== */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead tr { border-bottom: 2px solid var(--border); }
thead th { padding: 12px 16px; text-align: left; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }

tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 14px 16px; font-size: 0.92rem; }
tbody tr:last-child { border-bottom: none; }

/* ==============================
   BADGES / TAGS
============================== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ==============================
   FORMULÁRIOS
============================== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 600; font-size: 0.88rem; color: var(--dark); margin-bottom: 8px; }
.form-control {
    width: 100%;
    padding: 11px 15px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,71,255,0.1); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ==============================
   LOGIN / TELAS PÚBLICAS
============================== */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo img { height: 48px; }
.auth-logo h2 { font-size: 1.3rem; font-weight: 700; color: var(--dark); margin-top: 12px; }
.auth-logo p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

.tab-switcher { display: flex; background: var(--secondary); border-radius: 10px; padding: 4px; margin-bottom: 28px; gap: 4px; }
.tab-btn { flex: 1; padding: 9px; border: none; border-radius: 7px; background: transparent; font-weight: 600; font-size: 0.88rem; cursor: pointer; color: var(--text-muted); transition: all 0.2s; font-family: 'Outfit', sans-serif; }
.tab-btn.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); }

.auth-error { background: #fee2e2; color: #991b1b; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }

/* ==============================
   ALERTAS E FEEDBACK
============================== */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 0.9rem; display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }

/* ==============================
   GRADES / ESTATÍSTICAS
============================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 32px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }

/* ==============================
   MODAL
============================== */
.modal-overlay { position: fixed; top:0; left:0; width:100%; height:100%; 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.open { display: flex; }
.modal { 
    background: white; 
    border-radius: 24px; 
    padding: 40px; 
    width: 100%; 
    max-width: 520px; 
    max-height: 90vh; 
    overflow-y: auto; 
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.modal-header h3 { font-size: 1.3rem; font-weight: 800; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }

/* SIDE DRAWER (PAINEL LATERAL) - FORÇANDO REGRAS */
.drawer-overlay { 
    position: fixed !important; 
    top: 0 !important; 
    left: 0 !important; 
    width: 100% !important; 
    height: 100% !important; 
    background: rgba(0,0,0,0.6) !important; 
    backdrop-filter: blur(8px) !important; 
    z-index: 9999 !important; 
    display: none; 
    justify-content: flex-end !important; 
}
.drawer-overlay.open { display: flex !important; }

.drawer { 
    background: white !important; 
    width: 100% !important; 
    max-width: 500px !important; 
    height: 100% !important; 
    box-shadow: -10px 0 30px rgba(0,0,0,0.2) !important; 
    display: flex !important; 
    flex-direction: column !important; 
    animation: drawerIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes drawerIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.drawer-header { padding: 30px !important; border-bottom: 1px solid #f0f0f0 !important; display: flex !important; justify-content: space-between !important; align-items: flex-start !important; }
.drawer-close { background: none !important; border: none !important; font-size: 2.5rem !important; cursor: pointer !important; color: #999 !important; line-height: 1 !important; }
.drawer-body { padding: 40px 30px !important; flex: 1 !important; overflow-y: auto !important; }
.drawer-form .form-group { margin-bottom: 20px !important; text-align: left !important; }
.drawer-form label { display: block !important; margin-bottom: 8px !important; font-weight: 700 !important; color: var(--dark) !important; font-size: 0.9rem !important; }
.drawer-form input { 
    width: 100% !important; 
    padding: 14px 18px !important; 
    border: 2px solid #eee !important; 
    border-radius: 14px !important; 
    font-size: 1rem !important; 
    transition: all 0.3s !important; 
    box-sizing: border-box !important;
}
.drawer-form input:focus { border-color: var(--primary) !important; outline: none !important; box-shadow: 0 0 0 4px var(--primary-light) !important; }

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ==============================
   UTILIDADES
============================== */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-2 { gap: 12px; } .gap-3 { gap: 20px; }
.color-success { color: var(--success); } .color-danger { color: var(--danger); }
