@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #0f172a;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px -2px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 32px -8px rgba(0,0,0,0.12), 0 8px 16px -8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    font-feature-settings: 'cv02', 'cv03', 'cv11';
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -0.02em; font-weight: 700; }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    color: #cbd5e1;
    padding: 20px 14px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 10px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 18px;
}
.sidebar-brand-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 20px;
    box-shadow: 0 6px 16px rgba(99,102,241,0.4);
}
.sidebar-brand-text {
    font-weight: 800; color: white;
    font-size: 1.2rem; letter-spacing: -0.02em;
}
.sidebar-brand-text small { display: block; font-size: 0.65rem; color: #94a3b8; font-weight: 400; letter-spacing: 0.05em; text-transform: uppercase; }

.sidebar-section {
    text-transform: uppercase; font-size: 0.7rem;
    color: #64748b; padding: 14px 12px 6px;
    letter-spacing: 0.08em; font-weight: 600;
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; color: #cbd5e1;
    text-decoration: none; border-radius: 10px;
    font-size: 0.92rem; font-weight: 500;
    transition: all 0.15s ease;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: white; }
.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 8px 20px rgba(99,102,241,0.35);
}
.sidebar-nav i { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar-user {
    margin-top: auto; padding: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    display: flex; align-items: center; gap: 10px;
}
.sidebar-user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 0.95rem;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { color: white; font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: #94a3b8; font-size: 0.72rem; text-transform: capitalize; }
.sidebar-user a { color: #94a3b8; text-decoration: none; padding: 6px; border-radius: 6px; transition: all 0.15s; }
.sidebar-user a:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }

/* ===== MAIN ===== */
.main-content { flex: 1; padding: 28px 32px; overflow-x: hidden; }

.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 1.6rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 10px; }
.page-title i { color: var(--primary); }
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card:hover::before { opacity: 1; }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: white;
    margin-bottom: 14px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.1);
}
.stat-label { color: var(--text-muted); font-size: 0.82rem; font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stat-sub { color: var(--text-muted); font-size: 0.75rem; margin-top: 6px; }

.gradient-primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.gradient-success { background: linear-gradient(135deg, #10b981, #06b6d4); }
.gradient-warning { background: linear-gradient(135deg, #f59e0b, #f97316); }
.gradient-info { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.gradient-pink { background: linear-gradient(135deg, #ec4899, #f43f5e); }

/* ===== BUTTONS ===== */
.btn {
    border-radius: 10px;
    font-weight: 500;
    padding: 9px 18px;
    transition: all 0.15s;
    border: 1px solid transparent;
    font-size: 0.9rem;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99,102,241,0.4); color: white; }

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16,185,129,0.4); color: white; }

.btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-outline-primary { color: var(--primary); border-color: var(--border); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: white; border-color: var(--primary); }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--border); background: transparent; }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-outline-success { color: var(--success); border-color: var(--border); background: transparent; }
.btn-outline-success:hover { background: var(--success); color: white; border-color: var(--success); }
.btn-outline-warning { color: var(--warning); border-color: var(--border); background: transparent; }
.btn-outline-warning:hover { background: var(--warning); color: white; border-color: var(--warning); }
.btn-outline-danger { color: var(--danger); border-color: var(--border); background: transparent; }
.btn-outline-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }
.btn-outline-info { color: var(--info); border-color: var(--border); background: transparent; }
.btn-outline-info:hover { background: var(--info); color: white; border-color: var(--info); }

.btn-group .btn { border-radius: 8px; margin-right: 4px; }
.btn-group .btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== FORMS ===== */
.form-control, .form-select {
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 10px 14px;
    font-size: 0.92rem;
    transition: all 0.15s;
    background: var(--surface);
    color: var(--text);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    outline: none;
}
.form-control-lg { padding: 12px 16px; font-size: 1rem; }
.form-label { font-weight: 500; font-size: 0.85rem; margin-bottom: 6px; color: var(--text); }
.form-control:disabled, .form-control[readonly] { background: var(--surface-2); }

/* ===== TABLE ===== */
.table { width: 100%; border-collapse: collapse; }
.table th {
    font-weight: 600; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px; background: var(--surface-2);
    text-align: left;
}
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: var(--surface-2); }
.table-responsive { overflow-x: auto; border-radius: 16px; }

/* ===== BADGES ===== */
.badge {
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.bg-primary, .badge.bg-primary { background: rgba(99,102,241,0.12) !important; color: var(--primary) !important; }
.bg-success, .badge.bg-success { background: rgba(16,185,129,0.12) !important; color: var(--success) !important; }
.bg-warning, .badge.bg-warning { background: rgba(245,158,11,0.12) !important; color: var(--warning) !important; }
.bg-danger, .badge.bg-danger { background: rgba(239,68,68,0.12) !important; color: var(--danger) !important; }
.bg-info, .badge.bg-info { background: rgba(6,182,212,0.12) !important; color: var(--info) !important; }
.bg-secondary, .badge.bg-secondary { background: var(--surface-2) !important; color: var(--text-muted) !important; }

/* ===== ALERTS ===== */
.alert {
    border-radius: 12px;
    padding: 12px 16px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.alert-success { background: rgba(16,185,129,0.08); color: #047857; border-color: rgba(16,185,129,0.2); }
.alert-danger { background: rgba(239,68,68,0.08); color: #b91c1c; border-color: rgba(239,68,68,0.2); }
.alert-warning { background: rgba(245,158,11,0.08); color: #b45309; border-color: rgba(245,158,11,0.2); }
.alert-info { background: rgba(6,182,212,0.08); color: #0e7490; border-color: rgba(6,182,212,0.2); }

/* ===== CALENDAR ===== */
.fc { font-family: 'Inter', sans-serif; }
.fc .fc-toolbar-title { font-size: 1.2rem !important; font-weight: 700; letter-spacing: -0.01em; }
.fc .fc-button {
    background: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: 8px !important;
    text-transform: capitalize !important;
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
    box-shadow: none !important;
    font-weight: 500 !important;
}
.fc .fc-button:hover { background: var(--primary) !important; color: white !important; border-color: var(--primary) !important; }
.fc .fc-button-active, .fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--primary) !important; color: white !important; border-color: var(--primary) !important;
}
.fc-event {
    border-radius: 6px !important;
    border: none !important;
    padding: 3px 7px !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: transform 0.1s;
}
.fc-event:hover { transform: scale(1.02); }
.fc-day-today { background: rgba(99,102,241,0.06) !important; }
.fc-col-header-cell { background: var(--surface-2); }
.fc-col-header-cell-cushion { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px !important; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--border) !important; }

/* Notas têm um estilo diferente no calendário */
.fc-event.nota { border-left: 3px dashed rgba(255,255,255,0.5) !important; opacity: 0.95; }

/* ===== MODAL ===== */
.modal-content { border-radius: 16px; border: none; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 20px; }

/* ===== LIST GROUP ===== */
.list-group-item { border-color: var(--border); padding: 12px 16px; }
.list-group-item:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.list-group-item:last-child { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }

/* ===== INFO BOX (event detail) ===== */
.info-row {
    display: flex; align-items: flex-start;
    padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-label {
    color: var(--text-muted); font-size: 0.82rem;
    font-weight: 500; min-width: 110px;
}
.info-value { flex: 1; font-size: 0.92rem; }

/* ===== TIPO TOGGLE (evento vs nota) ===== */
.tipo-toggle {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    background: var(--surface-2); padding: 6px; border-radius: 12px;
}
.tipo-toggle input { display: none; }
.tipo-toggle label {
    cursor: pointer; padding: 14px;
    border-radius: 8px; text-align: center;
    transition: all 0.15s; border: 2px solid transparent;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.tipo-toggle label i { font-size: 1.4rem; }
.tipo-toggle input:checked + label {
    background: var(--surface); border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99,102,241,0.2);
    color: var(--primary);
}

/* ===== SIMULADOR ===== */
.simulator {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 16px; padding: 18px;
    border: 1px solid #fcd34d;
}
.simulator-result {
    background: white; border-radius: 10px;
    padding: 12px; margin-top: 12px;
}
.simulator-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.88rem; }
.simulator-row strong { font-size: 0.95rem; }

/* ===== MOBILE ===== */
.mobile-toggle { display: none; }

@media (max-width: 992px) {
    .sidebar {
        position: fixed; left: -280px; z-index: 1000;
        transition: left 0.3s ease; width: 280px;
        box-shadow: 0 0 40px rgba(0,0,0,0.2);
    }
    .sidebar.open { left: 0; }
    .main-content { padding: 16px; }
    .mobile-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 40px; height: 40px;
        background: var(--surface); border: 1px solid var(--border);
        border-radius: 10px; cursor: pointer; color: var(--text);
    }
    .sidebar-backdrop {
        display: none; position: fixed; inset: 0;
        background: rgba(0,0,0,0.4); z-index: 999;
    }
    .sidebar-backdrop.open { display: block; }
    .page-title { font-size: 1.3rem; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.4rem; }
}

/* ===== UTILS ===== */
.text-muted { color: var(--text-muted) !important; }
.text-warning { color: var(--warning) !important; }
.text-success { color: var(--success) !important; }
.text-info { color: var(--info) !important; }
.text-danger { color: var(--danger) !important; }
.text-primary { color: var(--primary) !important; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }