@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

/* ==================== BASE ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Montserrat", sans-serif;
    background: #f5f6f8;
    color: #2c3e50;
    font-size: 0.9375rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ==================== TOPBAR ==================== */
.topbar {
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #e1e4e8;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.topbar-inner {
    max-width: 1340px;
    margin: 0 auto;
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.brand-text .city {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-text .city span:first-child {
    color: #1a202c;
}

.brand-text .city span:last-child {
    color: #c53030;
}

.brand-text .subline {
    font-size: 0.78rem;
    color: #718096;
    font-weight: 400;
}

/* Hamburger menu (caché par défaut) */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 60;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #1a202c;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Navigation */
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    flex: 1;
    justify-content: center;
}

.topbar-nav a {
    text-decoration: none;
    color: #4a5568;
    transition: all 0.18s ease;
    padding: 10px 22px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.topbar-nav a:hover {
    color: #c53030;
    background: #fff5f5;
}

.topbar-nav a.active {
    color: #ffffff;
    background: #c53030;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(197, 48, 48, 0.2);
}

/* ==================== MAIN CONTAINER ==================== */
.app {
    max-width: 1340px;
    margin: 28px auto;
    padding: 0 32px;
}

.breadcrumb {
    font-size: 0.8125rem;
    color: #718096;
    margin-bottom: 14px;
    font-weight: 400;
}

/* ==================== HEADER ==================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 48px;
    margin-bottom: 28px;
}

.title-block {
    flex: 1;
}

.title-block h1 {
    margin: 0 0 10px;
    font-size: 1.875rem;
    font-weight: 600;
    line-height: 1.2;
    color: #1a202c;
    letter-spacing: -0.02em;
}

.title-block p {
    margin: 0 0 10px;
    color: #718096;
    font-size: 1rem;
    line-height: 1.6;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    background: #fefcbf;
    border: 1px solid #ecc94b;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    margin-top: 10px;
    font-weight: 500;
}

.badge .dot {
    width: 7px;
    height: 7px;
    background: #d69e2e;
    border-radius: 50%;
    margin-right: 7px;
    flex-shrink: 0;
}

/* Stats */
.stats {
    display: flex;
    gap: 18px;
}

.stat-card {
    background: #ffffff;
    padding: 20px 24px;
    border-radius: 10px;
    border: 1px solid #e1e4e8;
    width: 210px;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: #c53030;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.stat-label {
    font-size: 0.6875rem;
    color: #718096;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #1a202c;
    letter-spacing: -0.02em;
}

.stat-sub {
    font-size: 0.75rem;
    color: #a0aec0;
    font-weight: 400;
}

/* ==================== TOOLBAR ==================== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    padding: 16px 24px;
    border-radius: 10px;
    border: 1px solid #e1e4e8;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-wrap: wrap;
}

.search-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 380px;
    min-width: 280px;
    background: #f7fafc;
    padding: 11px 16px;
    border-radius: 8px;
    border: 1px solid #e1e4e8;
    transition: all 0.18s ease;
}

.search-group:focus-within {
    background: #ffffff;
    border-color: #c53030;
    box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.08);
}

.search-icon {
    font-size: 1.125rem;
    color: #a0aec0;
    flex-shrink: 0;
}

.search-group input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #2c3e50;
    font-weight: 400;
}

.search-group input:focus {
    outline: none;
}

.search-group input::placeholder {
    color: #a0aec0;
}

.pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 11px 18px;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.pill:hover {
    background: #f7fafc;
    border-color: #c53030;
}

.pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d69e2e;
    flex-shrink: 0;
}

/* ==================== TABLE ==================== */
.table-card {
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.table-header {
    padding: 18px 24px;
    border-bottom: 1px solid #e1e4e8;
    font-size: 0.875rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7fafc;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: auto;
}

thead {
    background: #f7fafc;
}

th {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 2px solid #e1e4e8;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #718096;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Largeurs optimisées par colonne */
th:nth-child(1), td:nth-child(1) { width: 110px; min-width: 110px; }
th:nth-child(2), td:nth-child(2) { width: 280px; min-width: 180px; }
th:nth-child(3), td:nth-child(3) { width: 160px; min-width: 240px; }
th:nth-child(4), td:nth-child(4) { width: 90px; min-width: 90px; text-align: center; }
th:nth-child(5), td:nth-child(5) { width: 110px; min-width: 110px; text-align: center; }
th:nth-child(6), td:nth-child(6) { width: 140px; min-width: 120px; }
th:nth-child(7), td:nth-child(7) { width: 90px; min-width: 90px; text-align: center; }
th:nth-child(8), td:nth-child(8) { width: 150px; min-width: 130px; }
th:nth-child(9), td:nth-child(9) { width: 150px; min-width: 130px; }
th:nth-child(10), td:nth-child(10) { width: 150px; min-width: 130px; }
th:nth-child(11), td:nth-child(11) { width: 120px; min-width: 120px; text-align: center; }

td {
    padding: 16px;
    font-size: 0.9375rem;
    vertical-align: middle;
    border-bottom: 1px solid #f0f2f5;
    color: #2c3e50;
    font-weight: 400;
}

tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:hover {
    background: #f7fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

.name-cell {
    font-weight: 500;
    color: #1a202c;
}

/* ==================== FORM ELEMENTS ==================== */
input[type="text"],
input[type="date"],
input[type="time"],
input[type="email"],
input[type="password"],
textarea,
select {
    font-family: inherit;
    font-size: 0.9375rem;
}

.grade-input {
    width: 68px;
    padding: 9px 11px;
    border: 1px solid #e1e4e8;
    border-radius: 7px;
    font-size: 0.9375rem;
    text-align: center;
    font-weight: 600;
    font-family: inherit;
}

.notes-input {
    width: 100%;
    min-height: 75px;
    padding: 11px 13px;
    border-radius: 7px;
    border: 1px solid #e1e4e8;
    font-size: 0.9375rem;
    resize: vertical;
    font-family: inherit;
}

/* ==================== BUTTONS ==================== */
.btn {
    border: 1px solid #e1e4e8;
    padding: 11px 20px;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
    text-decoration: none;
    color: #4a5568;
}

.btn:hover {
    background: #f7fafc;
    border-color: #c53030;
    color: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn.primary {
    background: #c53030;
    color: #ffffff;
    border-color: #c53030;
    box-shadow: 0 2px 6px rgba(197, 48, 48, 0.2);
}

.btn.primary:hover {
    background: #9b2c2c;
    border-color: #9b2c2c;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(197, 48, 48, 0.3);
}

/* ==================== CHIPS ==================== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.chip .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chip.green { 
    background: #c6f6d5; 
    color: #22543d; 
}

.chip.green .dot { 
    background: #38a169; 
}

.chip.orange { 
    background: #feebc8; 
    color: #7c2d12; 
}

.chip.orange .dot { 
    background: #dd6b20; 
}

.chip.red { 
    background: #fed7d7; 
    color: #742a2a; 
}

.chip.red .dot { 
    background: #e53e3e; 
}

/* ==================== AVERAGE PILLS ==================== */
.avg-pill {
    display: inline-block;
    padding: 6px 13px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8125rem;
}

.avg-good {
    background: #c6f6d5;
    color: #22543d;
}

.avg-medium {
    background: #feebc8;
    color: #7c2d12;
}

.avg-bad {
    background: #fed7d7;
    color: #742a2a;
}

/* ==================== FOOTER ==================== */
footer {
    margin-top: 56px;
    padding: 28px 0;
    text-align: center;
    font-size: 0.8125rem;
    color: #718096;
    border-top: 1px solid #e1e4e8;
    font-weight: 400;
}

/* ==================== RESPONSIVE - TABLET ==================== */
@media (max-width: 1024px) {
    .app {
        margin: 20px auto;
        padding: 0 20px;
    }
    
    header {
        gap: 32px;
    }
    
    .stats {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .stat-card {
        width: calc(50% - 9px);
    }
    
    .search-group {
        max-width: 320px;
    }
}

/* ==================== RESPONSIVE - MOBILE ==================== */
@media (max-width: 768px) {
    body {
        font-size: 0.9375rem;
    }
    
    .topbar-inner {
        padding: 16px 20px;
    }
    
    /* Afficher le hamburger */
    .hamburger {
        display: flex;
    }
    
    /* Menu mobile - caché par défaut */
    .topbar-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #ffffff;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 80px 24px 24px;
        gap: 8px;
        box-shadow: -2px 0 12px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 55;
        overflow-y: auto;
    }
    
    /* Menu ouvert */
    .topbar-nav.active {
        right: 0;
    }
    
    body.menu-open {
        overflow: hidden;
    }
    
    .topbar-nav a {
        padding: 16px 20px;
        border-radius: 8px;
        border: 1px solid #e1e4e8;
        width: 100%;
        justify-content: flex-start;
        font-size: 0.9375rem;
    }
    
    .topbar-nav a.active {
        background: #c53030;
        color: #fff;
        border-color: #c53030;
        font-weight: 600;
    }
    
    .brand-text {
        flex: 1;
    }
    
    .brand-text .city {
        font-size: 1.2rem;
    }
    
    .brand-text .subline {
        font-size: 0.75rem;
    }
    
    header {
        flex-direction: column;
        gap: 24px;
        margin-bottom: 20px;
    }
    
    .title-block h1 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .title-block p {
        text-align: center;
    }
    
    .badge {
        display: flex;
        justify-content: center;
    }
    
    .stats {
        width: 100%;
        justify-content: space-between;
        gap: 14px;
    }
    
    .stat-card {
        width: calc(50% - 7px);
        padding: 16px 18px;
        min-height: 88px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 20px;
    }
    
    .toolbar-right {
        flex-direction: column;
        gap: 12px;
        margin-left: 0;
        width: 100%;
    }
    
    .toolbar-right .btn {
        width: 100%;
    }
    
    .search-group {
        max-width: none;
        width: 100%;
    }
    
    .search-group input {
        padding: 12px 16px;
        font-size: 16px;
    }
    
    .pill {
        width: 100%;
        justify-content: center;
        padding: 12px 18px;
    }
    
    .app {
        margin: 16px auto;
        padding: 0 16px;
    }
    
    .table-header {
        flex-direction: column;
        gap: 12px;
        padding: 18px;
        align-items: flex-start;
    }
    
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }
    
    th, td {
        padding: 16px 12px;
        font-size: 0.875rem;
    }
    
    th {
        padding: 14px 12px;
    }
    
    .btn {
        padding: 13px 22px;
        min-height: 46px;
        font-size: 0.9375rem;
    }
    
    .grade-input {
        width: 72px;
        padding: 11px;
        font-size: 16px;
    }
    
    .notes-input {
        min-height: 88px;
        font-size: 16px;
        padding: 13px;
    }
    
    input, textarea, select {
        font-size: 16px !important;
    }
    
    table .btn,
    .table-card .btn,
    td button {
        padding: 9px 16px !important;
        font-size: 0.875rem !important;
        min-height: 38px !important;
        border-radius: 7px !important;
    }
    
    td:has(.btn),
    th:has(.btn) {
        padding: 10px 12px !important;
    }
}

/* ==================== RESPONSIVE - SMALL MOBILE ==================== */
@media (max-width: 480px) {
    .topbar-inner {
        padding: 14px 16px;
    }
    
    .brand-text .city {
        font-size: 1.1rem;
    }
    
    .title-block h1 {
        font-size: 1.375rem;
    }
    
    .stats {
        flex-direction: column;
        gap: 14px;
    }
    
    .stat-card {
        width: 100%;
        padding: 18px 20px;
    }
    
    .topbar-nav {
        width: 100%;
        right: -100%;
    }
    
    table {
        font-size: 0.8125rem;
    }
    
    th, td {
        padding: 14px 10px;
    }
    
    .toolbar {
        padding: 18px;
    }
    
    .app {
        padding: 0 12px;
    }
    
    footer {
        padding: 24px 16px;
        font-size: 0.78125rem;
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes pulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); 
    }
}

/* ==================== UTILITY CLASSES ==================== */
/* Les modes view/edit sont gérés par JavaScript */