/* =====================================================
   HiSchool3 - Styles principaux
   ===================================================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --primary-dark: #0d1642;
    --secondary: #0d47a1;
    --accent: #ff6f00;
    --accent-light: #ffa040;
    --success: #2e7d32;
    --warning: #f57f17;
    --danger: #c62828;
    --info: #0277bd;
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #212121;
    --text-secondary: #616161;
    --text-muted: #9e9e9e;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =====================================================
   Layout: Sidebar
   ===================================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    z-index: 1000;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo-icon {
    font-size: 36px;
    margin-bottom: 5px;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-header p {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 2px;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav .nav-section {
    padding: 10px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.5;
    font-weight: 600;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--accent);
}

.sidebar-nav .nav-item.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 600;
}

.sidebar-nav .nav-item i {
    width: 22px;
    margin-right: 12px;
    font-size: 16px;
    text-align: center;
}

.sidebar-nav .nav-item .badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    position: absolute;
    bottom: 0;
    width: 100%;
    background: var(--primary-dark);
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.sidebar-footer .user-details {
    flex: 1;
}

.sidebar-footer .user-name {
    font-size: 13px;
    font-weight: 600;
}

.sidebar-footer .user-role {
    font-size: 11px;
    opacity: 0.7;
}

.sidebar-footer .logout-btn {
    color: rgba(255,255,255,0.6);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-footer .logout-btn:hover {
    color: var(--danger);
}

/* =====================================================
   Layout: Main Content
   ===================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.top-header .page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.top-header .header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-header .header-actions .btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-main);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.top-header .header-actions .btn-icon:hover {
    background: var(--primary);
    color: #fff;
}

.top-header .header-actions .btn-icon .notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Content Area */
.content-area {
    padding: 25px 30px;
}

/* =====================================================
   Cards & Widgets
   ===================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 22px;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: #fafafa;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    border-left: 4px solid var(--primary);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
}

.stat-card .stat-info h4 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-card .stat-info .stat-change {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 600;
}

.stat-card .stat-info .stat-change.up { color: var(--success); }
.stat-card .stat-info .stat-change.down { color: var(--danger); }

/* Grid */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* =====================================================
   Tables
   ===================================================== */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-primary);
}

table tbody tr:hover {
    background: #f5f7ff;
}

table tbody tr:nth-child(even) {
    background: #fafbfc;
}

table tbody tr:nth-child(even):hover {
    background: #f5f7ff;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,35,126,0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-secondary:hover {
    background: #1565c0;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #388e3c;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #f9a825;
}

.btn-info {
    background: var(--info);
    color: #fff;
}

.btn-info:hover {
    background: #0288d1;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* =====================================================
   Forms
   ===================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
    background: #fff;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* =====================================================
   Badges & Tags
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary { background: #e8eaf6; color: var(--primary); }
.badge-success { background: #e8f5e9; color: var(--success); }
.badge-warning { background: #fff8e1; color: var(--warning); }
.badge-danger { background: #ffebee; color: var(--danger); }
.badge-info { background: #e1f5fe; color: var(--info); }

/* =====================================================
   Alerts
   ===================================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #e8f5e9; color: var(--success); border: 1px solid #a5d6a7; }
.alert-danger { background: #ffebee; color: var(--danger); border: 1px solid #ef9a9a; }
.alert-warning { background: #fff8e1; color: var(--warning); border: 1px solid #ffe082; }
.alert-info { background: #e1f5fe; color: var(--info); border: 1px solid #81d4fa; }

/* =====================================================
   Modal
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-header .close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-main);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-header .close-btn:hover {
    background: var(--danger);
    color: #fff;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =====================================================
   Tabs
   ===================================================== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* =====================================================
   Pagination
   ===================================================== */
.pagination {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--primary);
    color: #fff;
}

.pagination .active {
    background: var(--primary);
    color: #fff;
}

/* =====================================================
   Progress Bar
   ===================================================== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar .progress-fill.green { background: var(--success); }
.progress-bar .progress-fill.blue { background: var(--info); }
.progress-bar .progress-fill.orange { background: var(--warning); }
.progress-bar .progress-fill.red { background: var(--danger); }

/* =====================================================
   Timeline
   ===================================================== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item .time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-item .content {
    font-size: 14px;
    color: var(--text-primary);
}

/* =====================================================
   Empty State
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 {
        grid-template-columns: 1fr;
    }
    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }
    .content-area {
        padding: 15px;
    }
    .top-header {
        padding: 0 15px;
    }
}

/* =====================================================
   Utilities
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-primary { color: var(--primary); }

.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; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.fw-bold { font-weight: 700; }
.fs-sm { font-size: 12px; }
.fs-md { font-size: 14px; }
.fs-lg { font-size: 18px; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.rounded { border-radius: var(--radius); }
.shadow { box-shadow: var(--shadow); }

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Print */
@media print {
    .sidebar, .top-header { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0 !important; }
}