:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --light: #f8fafc;
    --dark: #1e293b;
    --sidebar-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background: #f1f5f9; color: #334155; }

/* LOGIN */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-box { background: white; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden; }
.login-header { background: var(--primary); color: white; padding: 30px; text-align: center; }
.login-header i { font-size: 48px; margin-bottom: 15px; display: block; }
.login-header h2 { font-size: 22px; margin-bottom: 8px; }
.login-header p { opacity: 0.9; font-size: 14px; }
#loginForm { padding: 30px; }
.input-group { margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--dark); font-size: 14px; }
.input-group label i { margin-right: 6px; color: var(--primary); }
.input-group input {
    width: 100%; padding: 12px 15px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 15px; transition: all 0.3s;
}
.input-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.btn-login {
    width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 8px;
    font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s;
}
.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); }
.login-error { margin-top: 15px; color: var(--danger); font-size: 14px; text-align: center; display: none; }

/* APP LAYOUT */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width); background: var(--dark); color: white; position: fixed;
    height: 100vh; left: 0; top: 0; z-index: 100; transition: all 0.3s; display: flex; flex-direction: column;
}
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: center; }
.sidebar-header i { font-size: 36px; color: var(--primary); margin-bottom: 10px; }
.sidebar-header h3 { font-size: 16px; font-weight: 600; }
.sidebar-header p { font-size: 12px; opacity: 0.7; margin-top: 4px; }
.sidebar-menu { flex: 1; padding: 15px 0; overflow-y: auto; }
.menu-item {
    display: flex; align-items: center; padding: 14px 20px; color: rgba(255,255,255,0.8);
    text-decoration: none; cursor: pointer; transition: all 0.3s; border-left: 3px solid transparent;
}
.menu-item:hover, .menu-item.active { background: rgba(255,255,255,0.1); color: white; border-left-color: var(--primary); }
.menu-item i { width: 24px; margin-right: 12px; font-size: 16px; text-align: center; }
.menu-item span { font-size: 14px; font-weight: 500; }
.sidebar-footer { padding: 15px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-info i { font-size: 28px; color: var(--primary); }
.user-info .name { font-size: 14px; font-weight: 600; }
.user-info .role { font-size: 12px; opacity: 0.7; }
.btn-logout {
    width: 100%; padding: 10px; background: rgba(255,255,255,0.1); color: white; border: none;
    border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.3s;
}
.btn-logout:hover { background: var(--danger); }

.sidebar-toggle {
    display: none; position: fixed; top: 15px; left: 15px; z-index: 110; width: 44px; height: 44px;
    background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 20px;
    cursor: pointer; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 95; }
.sidebar.open + .sidebar-overlay, .sidebar.open ~ .main-content .sidebar-overlay { display: block; }

.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 25px; min-height: 100vh; }

.page-header { margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.page-header h2 { font-size: 24px; color: var(--dark); display: flex; align-items: center; gap: 10px; }
.page-header h2 i { color: var(--primary); }

/* CARDS */
.card { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 20px; margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #e2e8f0; }
.card-title { font-size: 16px; font-weight: 600; color: var(--dark); display: flex; align-items: center; gap: 8px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); display: flex; align-items: center; gap: 15px; transition: transform 0.3s; }
.stat-card:hover { transform: translateY(-2px); }
.stat-icon { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-icon.yellow { background: #fef9c3; color: var(--warning); }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-info h4 { font-size: 13px; color: var(--secondary); font-weight: 500; margin-bottom: 4px; }
.stat-info p { font-size: 22px; font-weight: 700; color: var(--dark); }

/* BUTTONS */
.btn {
    padding: 10px 18px; border: none; border-radius: 8px; font-size: 14px; font-weight: 500;
    cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: all 0.3s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #a16207; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #475569; }
.btn-info { background: #0ea5e9; color: white; }
.btn-info:hover { background: #0284c7; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* TABLES */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table thead th {
    background: #f8fafc; padding: 12px 15px; text-align: left; font-size: 13px; font-weight: 600;
    color: var(--secondary); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #e2e8f0; white-space: nowrap;
}
.data-table tbody td { padding: 14px 15px; border-bottom: 1px solid #f1f5f9; font-size: 14px; white-space: nowrap; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table .actions { display: flex; gap: 6px; flex-wrap: nowrap; }

/* TOOLBAR */
.toolbar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: flex-end; }
.search-box { flex: 1; min-width: 200px; position: relative; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--secondary); }
.search-box input { width: 100%; padding: 10px 12px 10px 38px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 14px; }
.search-box input:focus { outline: none; border-color: var(--primary); }

/* FORMS */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--dark); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 14px; transition: all 0.3s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* MODAL */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5);
    z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: 12px; width: 100%; max-width: 700px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { padding: 20px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--secondary); cursor: pointer; width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #f1f5f9; color: var(--dark); }
.modal-body { padding: 20px; }
.modal-footer { padding: 15px 20px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 10px; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 40px; color: var(--secondary); }
.empty-state i { font-size: 48px; margin-bottom: 15px; opacity: 0.5; }

/* BADGE */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-primary { background: #dbeafe; color: var(--primary); }
.badge-success { background: #dcfce7; color: var(--success); }
.badge-warning { background: #fef9c3; color: var(--warning); }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-secondary { background: #e2e8f0; color: var(--secondary); }

/* SCHEDULE GRID */
.schedule-grid { display: grid; grid-template-columns: 80px repeat(5, 1fr); gap: 4px; margin-top: 15px; }
.schedule-header { background: var(--primary); color: white; padding: 10px; text-align: center; font-size: 12px; font-weight: 600; border-radius: 6px; }
.schedule-cell {
    background: white; border: 2px solid #e2e8f0; border-radius: 6px; padding: 8px; text-align: center;
    font-size: 12px; cursor: pointer; transition: all 0.2s; min-height: 50px; display: flex; align-items: center; justify-content: center;
}
.schedule-cell:hover { border-color: var(--primary); background: #eff6ff; }
.schedule-cell.selected { background: #dbeafe; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.schedule-cell.occupied { background: #dcfce7; border-color: var(--success); color: var(--success); }
.schedule-cell.conflict { background: #fee2e2; border-color: var(--danger); color: var(--danger); }
.schedule-time { background: #f8fafc; font-weight: 600; color: var(--secondary); }

/* PREFERENCE CHECKBOXES */
.pref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; }
.pref-item {
    border: 2px solid #e2e8f0; border-radius: 8px; padding: 10px; cursor: pointer;
    text-align: center; transition: all 0.2s;
}
.pref-item:hover { border-color: var(--primary); }
.pref-item.active { background: #dbeafe; border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* FOOTER */
.app-footer {
    position: fixed; bottom: 0; left: var(--sidebar-width); right: 0; background: white;
    border-top: 1px solid #e2e8f0; padding: 10px 25px; display: flex; justify-content: space-between;
    align-items: center; font-size: 12px; color: var(--secondary); z-index: 90;
}
.footer-user { font-weight: 500; color: var(--primary); }

/* PRINT */
@media print {
    .sidebar, .toolbar, .form-actions, .no-print, .sidebar-toggle, .sidebar-overlay, .app-footer { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 260px; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0; padding: 70px 15px 15px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 12px; gap: 10px; }
    .stat-icon { width: 42px; height: 42px; font-size: 18px; }
    .stat-info h4 { font-size: 11px; }
    .stat-info p { font-size: 16px; }
    .toolbar { gap: 8px; }
    .search-box { min-width: 100%; flex: none; }
    .data-table { font-size: 12px; }
    .data-table thead th { padding: 10px 8px; font-size: 11px; }
    .data-table tbody td { padding: 10px 8px; font-size: 12px; }
    .form-grid { grid-template-columns: 1fr; gap: 0; }
    .modal { max-width: 95%; max-height: 85vh; }
    .app-footer { left: 0; padding: 8px 15px; }
    .schedule-grid { grid-template-columns: 60px repeat(5, 1fr); }
    .schedule-header { font-size: 10px; padding: 6px; }
    .schedule-cell { font-size: 10px; padding: 4px; min-height: 36px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .modal-footer { flex-direction: column; }
    .modal-footer .btn { width: 100%; justify-content: center; }
    .toolbar .btn { width: 100%; justify-content: center; }
}
