/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #4F46E5; --primary-dark: #4338CA; --primary-light: #818CF8;
    --success: #10B981; --danger: #EF4444; --warning: #F59E0B; --info: #3B82F6;
    --gray-50: #F9FAFB; --gray-100: #F3F4F6; --gray-200: #E5E7EB; --gray-300: #D1D5DB;
    --gray-400: #9CA3AF; --gray-500: #6B7280; --gray-600: #4B5563; --gray-700: #374151;
    --gray-800: #1F2937; --gray-900: #111827;
    --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}
html { font-size: 14px; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50); color: var(--gray-800); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LOGIN PAGE === */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-card { background: white; border-radius: 12px; padding: 40px; width: 400px; max-width: 90vw;
    box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 1.5rem; color: var(--gray-900); margin-bottom: 8px; text-align: center; }
.login-card p { color: var(--gray-500); text-align: center; margin-bottom: 24px; font-size: 0.9rem; }
.login-card .logo { text-align: center; margin-bottom: 20px; font-size: 2.5rem; }

/* === LAYOUT === */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--gray-900); color: white; position: fixed; top: 0;
    left: 0; bottom: 0; overflow-y: auto; transition: transform 0.3s; z-index: 100; }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--gray-700); }
.sidebar-header h2 { font-size: 1.1rem; color: white; }
.sidebar-header small { color: var(--gray-400); font-size: 0.75rem; }
.sidebar-nav { padding: 12px 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: var(--gray-300);
    font-size: 0.9rem; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar-nav a:hover { background: var(--gray-800); color: white; text-decoration: none; }
.sidebar-nav a.active { background: var(--gray-800); color: white; border-left-color: var(--primary-light); }
.sidebar-nav .nav-section { padding: 12px 20px 6px; font-size: 0.7rem; text-transform: uppercase;
    color: var(--gray-500); letter-spacing: 1px; font-weight: 600; }
.sidebar-user { padding: 16px 20px; border-top: 1px solid var(--gray-700); position: absolute;
    bottom: 0; left: 0; right: 0; background: var(--gray-900); }
.sidebar-user .user-name { color: white; font-weight: 600; font-size: 0.85rem; }
.sidebar-user .user-role { color: var(--gray-400); font-size: 0.75rem; text-transform: capitalize; }

.main-content { margin-left: 260px; flex: 1; min-height: 100vh; }
.top-bar { background: white; border-bottom: 1px solid var(--gray-200); padding: 12px 24px;
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.top-bar h1 { font-size: 1.25rem; color: var(--gray-900); }
.top-bar-actions { display: flex; align-items: center; gap: 12px; }
.page-content { padding: 24px; }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius);
    font-size: 0.85rem; font-weight: 500; border: none; cursor: pointer; transition: all 0.2s; line-height: 1.4; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 4px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* === FORMS === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; font-size: 0.85rem; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: 0.9rem; transition: border-color 0.2s; background: white; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-control:disabled { background: var(--gray-100); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.75rem; color: var(--gray-500); margin-top: 2px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 2px; }

/* === CARDS === */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex;
    align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 1rem; color: var(--gray-900); }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* === STATS === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
    border-left: 4px solid var(--primary); }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: var(--gray-900); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: var(--info); }

/* === TABLE === */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 16px; font-size: 0.75rem; text-transform: uppercase;
    color: var(--gray-500); background: var(--gray-50); border-bottom: 2px solid var(--gray-200);
    letter-spacing: 0.5px; font-weight: 600; }
td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); font-size: 0.85rem; vertical-align: middle; }
tr:hover td { background: var(--gray-50); }

/* === BADGES === */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.72rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-draft { background: var(--gray-100); color: var(--gray-600); }
.badge-submitted { background: #DBEAFE; color: #1E40AF; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-on_hold { background: #FEF3C7; color: #92400E; }
.badge-cancelled { background: var(--gray-200); color: var(--gray-600); }
.badge-overridden { background: #FED7AA; color: #9A3412; }
.badge-completed { background: #E0E7FF; color: #3730A3; }
.badge-expired { background: var(--gray-200); color: var(--gray-500); }
.badge-room { background: #DBEAFE; color: #1E40AF; }
.badge-auditorium { background: #F3E8FF; color: #6B21A8; }
.badge-hall { background: #D1FAE5; color: #065F46; }
.badge-lab { background: #FEF3C7; color: #92400E; }

/* === MODAL === */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5);
    z-index: 200; display: flex; align-items: center; justify-content: center; opacity: 0;
    pointer-events: none; transition: opacity 0.2s; }
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.modal { background: white; border-radius: 12px; width: 600px; max-width: 90vw; max-height: 85vh;
    overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex;
    align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-400);
    padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); display: flex;
    justify-content: flex-end; gap: 8px; }

/* === TOAST/ALERTS === */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex;
    flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius); color: white; font-size: 0.85rem;
    box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; min-width: 280px; display: flex;
    align-items: center; justify-content: space-between; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }
.toast .close-toast { background: none; border: none; color: white; cursor: pointer; font-size: 1.1rem;
    opacity: 0.8; margin-left: 12px; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.85rem; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.alert-danger { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }

/* === CONFLICT WARNING === */
.conflict-warning { background: #FEF3C7; border: 1px solid #F59E0B; border-radius: var(--radius);
    padding: 12px 16px; margin: 12px 0; }
.conflict-warning h4 { color: #92400E; margin-bottom: 8px; font-size: 0.9rem; }
.conflict-item { font-size: 0.8rem; color: #78350F; padding: 4px 0; }

/* === CALENDAR === */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--gray-200); }
.calendar-header-cell { padding: 8px; text-align: center; font-weight: 600; font-size: 0.75rem;
    background: var(--gray-100); color: var(--gray-600); text-transform: uppercase; }
.calendar-cell { min-height: 100px; padding: 4px; background: white; font-size: 0.75rem; cursor: pointer; }
.calendar-cell:hover { background: var(--gray-50); }
.calendar-cell.other-month { background: var(--gray-50); color: var(--gray-400); }
.calendar-cell.today { background: #EEF2FF; }
.calendar-date { font-weight: 600; color: var(--gray-700); margin-bottom: 4px; padding: 2px 4px; }
.calendar-event { padding: 2px 4px; border-radius: 3px; margin-bottom: 2px; font-size: 0.68rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.calendar-event.SUBMITTED { background: #DBEAFE; color: #1E40AF; }
.calendar-event.APPROVED { background: #D1FAE5; color: #065F46; }
.calendar-event.ON_HOLD { background: #FEF3C7; color: #92400E; }

/* === TIMELINE / AUDIT === */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px;
    background: var(--gray-200); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -25px; top: 4px; width: 12px;
    height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid white;
    box-shadow: 0 0 0 2px var(--gray-200); }
.timeline-item .time { font-size: 0.72rem; color: var(--gray-500); }
.timeline-item .action { font-weight: 600; font-size: 0.85rem; color: var(--gray-800); }
.timeline-item .remarks { font-size: 0.8rem; color: var(--gray-600); margin-top: 2px; }

/* === LOADING === */
.spinner { width: 32px; height: 32px; border: 3px solid var(--gray-200); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 40px; }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-500); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--gray-700); margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; }

/* === CHECKBOX LIST === */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; padding: 6px 12px;
    border: 1px solid var(--gray-300); border-radius: var(--radius); cursor: pointer; font-size: 0.8rem;
    transition: all 0.2s; }
.checkbox-item:hover { border-color: var(--primary); }
.checkbox-item.selected { background: #EEF2FF; border-color: var(--primary); color: var(--primary); }
.checkbox-item input { display: none; }

/* === RESPONSIVE === */
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-700); }
@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .calendar-cell { min-height: 60px; }
}

/* === UTILITIES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-small { font-size: 0.8rem; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* Filter bar */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: end; }
.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-control { min-width: 150px; }
