/* ============================================
   RESET & BASE STYLES (Mobile First)
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bordeaux-primary: #8B0000;
    --bordeaux-dark: #5C0000;
    --bordeaux-light: #A52A2A;
    --bordeaux-accent: #C41E3A;
    --bordeaux-gradient: linear-gradient(135deg, #8B0000 0%, #A52A2A 100%);
    --bg-light: #FFF5F5;
    --bg-white: #FFFFFF;
    --text-dark: #2C2C2C;
    --text-light: #666666;
    --border-color: #E8D4D4;
    --shadow: 0 4px 12px rgba(139, 0, 0, 0.15);
    --shadow-hover: 0 6px 20px rgba(139, 0, 0, 0.25);
}

[data-theme="dark"] {
    --bordeaux-primary: #C41E3A;
    --bordeaux-dark: #8B0000;
    --bordeaux-light: #E63946;
    --bg-light: #1A1A1A;
    --bg-white: #2C2C2C;
    --text-dark: #F5F5F5;
    --text-light: #CCCCCC;
    --border-color: #444444;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   CONTAINER & LAYOUT - MOBILE FIRST
   ============================================ */
.container {
    max-width: 100%;
    margin: 0;
    background: var(--bg-white);
    min-height: 100vh;
    overflow-x: hidden; /* Empêche le scroll horizontal */
}

/* ============================================
   HEADER - MOBILE FIRST
   ============================================ */
header {
    background: var(--bordeaux-gradient);
    color: white;
    padding: 12px 12px 0 12px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 100%;
}

.header-content section {
    text-align: center;
    width: 100%;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    position: absolute;
    top: 12px;
    right: 12px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   NAVIGATION - MOBILE FIRST
   ============================================ */
.main-nav {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    padding: 0;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    padding-top: 12px;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.nav-btn span {
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-btn:active {
    transform: scale(0.98);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ============================================
   PAGES
   ============================================ */
.page {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header h1 {
    font-size: 1.3rem;
    margin-bottom: 4px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

header p {
    font-size: 0.75rem;
    opacity: 0.95;
    font-weight: 300;
    line-height: 1.3;
}

/* ============================================
   MAIN CONTENT - MOBILE FIRST
   ============================================ */
main {
    padding: 12px;
    max-width: 100%;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

/* ============================================
   STATISTICS SECTION
   ============================================ */
.stats-section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.stat-card {
    background: var(--bg-light);
    padding: 10px 8px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card:active {
    transform: scale(0.98);
}

.stat-card h3 {
    color: var(--bordeaux-primary);
    font-size: 0.65rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.stat-card .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.progress-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--bg-light);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: var(--bordeaux-gradient);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: none;
    border-left: 4px solid;
    font-size: 0.9rem;
}

.alert-success {
    background: #F0F9F4;
    color: #155724;
    border-color: #28a745;
}

.alert-info {
    background: #E8F4F8;
    color: #0c5460;
    border-color: var(--bordeaux-accent);
}

/* ============================================
   SECTIONS (Form, Settings, Table, Calendar, Charts)
   ============================================ */
.form-section,
.settings-section,
.table-section,
.calendar-section,
.charts-section,
.advanced-stats-section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.form-section h2,
.settings-section h2,
.table-section h2,
.calendar-section h2,
.charts-section h2,
.advanced-stats-section h2 {
    color: var(--bordeaux-primary);
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}

.settings-group {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.settings-group:last-child {
    border-bottom: none;
}

.settings-group h3 {
    color: var(--bordeaux-primary);
    font-size: 1.1rem;
    margin-bottom: 16px;
    font-weight: 700;
}

.settings-hint {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 8px;
    font-style: italic;
}

.settings-hint.warning {
    color: #dc3545;
    font-weight: 600;
}

.settings-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-buttons .btn {
    width: 100%;
}

.settings-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.settings-stat-item {
    background: var(--bg-light);
    padding: 16px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bordeaux-primary);
}

.form-section-header,
.table-section-header,
.calendar-section-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
    width: 100%;
}

.quick-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
}

.btn-quick {
    padding: 8px 16px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bordeaux-primary);
    cursor: pointer;
    transition: all 0.3s;
}

.btn-quick:active {
    transform: scale(0.95);
    background: var(--bordeaux-primary);
    color: white;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.templates-panel {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.templates-panel h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--bordeaux-primary);
}

.templates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-item {
    padding: 12px;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.template-item:active {
    transform: scale(0.98);
    border-color: var(--bordeaux-primary);
}

.table-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.search-input,
.filter-select,
.sort-select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px; /* Évite le zoom sur iOS */
    background: var(--bg-white);
    color: var(--text-dark);
    box-sizing: border-box;
}

.search-input:focus,
.filter-select:focus,
.sort-select:focus {
    outline: none;
    border-color: var(--bordeaux-primary);
}

/* ============================================
   CALENDAR
   ============================================ */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.calendar-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    flex: 1;
    text-align: center;
}

.calendar-nav-btn {
    background: var(--bordeaux-primary);
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.calendar-nav-btn:active {
    transform: scale(0.95);
    background: var(--bordeaux-dark);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    padding: 8px 4px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.2s;
    padding: 4px;
    position: relative;
    min-height: 44px;
}

.calendar-day:hover {
    border-color: var(--bordeaux-primary);
    transform: scale(1.05);
}

.calendar-day:active {
    transform: scale(0.95);
}

.calendar-day.other-month {
    opacity: 0.3;
    background: var(--bg-light);
}

.calendar-day.today {
    border-color: var(--bordeaux-primary);
    background: var(--bg-light);
    font-weight: 700;
}

.calendar-day.has-stage {
    background: rgba(139, 0, 0, 0.1);
    border-color: var(--bordeaux-primary);
}

.calendar-day.has-stage.low-hours {
    background: rgba(139, 0, 0, 0.15);
}

.calendar-day.has-stage.medium-hours {
    background: rgba(139, 0, 0, 0.25);
}

.calendar-day.has-stage.high-hours {
    background: rgba(139, 0, 0, 0.35);
    font-weight: 700;
}

.calendar-day-number {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.calendar-day-hours {
    font-size: 0.65rem;
    color: var(--bordeaux-primary);
    font-weight: 600;
    text-align: center;
    line-height: 1;
}

.calendar-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.calendar-views {
    display: flex;
    gap: 8px;
}

.view-btn {
    padding: 8px 16px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s;
}

.view-btn.active {
    background: var(--bordeaux-primary);
    color: white;
    border-color: var(--bordeaux-primary);
}

.view-btn:active {
    transform: scale(0.95);
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-dark);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.calendar-week-view,
.calendar-year-view {
    display: grid;
    gap: 8px;
}

.calendar-year-view {
    grid-template-columns: repeat(3, 1fr);
}

.year-month {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
}

.year-month h4 {
    font-size: 0.9rem;
    color: var(--bordeaux-primary);
    margin-bottom: 8px;
    text-align: center;
}

.year-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.year-month-day {
    aspect-ratio: 1;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    min-height: 24px;
}

.year-month-day.has-stage {
    background: rgba(139, 0, 0, 0.2);
}

.week-day {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.week-day:active {
    transform: scale(0.98);
    border-color: var(--bordeaux-primary);
}

.week-day.has-stage {
    background: rgba(139, 0, 0, 0.1);
    border-color: var(--bordeaux-primary);
}

.week-day h4 {
    color: var(--bordeaux-primary);
    margin-bottom: 8px;
    font-size: 1rem;
}

.week-day p {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.week-day p.no-data {
    color: var(--text-light);
    font-weight: 400;
    font-size: 0.9rem;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 16px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.85rem;
    line-height: 1.3;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px; /* Évite le zoom automatique sur iOS */
    transition: all 0.3s;
    background: var(--bg-white);
    color: var(--text-dark);
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--bordeaux-primary);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.form-group .value {
    font-size: 1.5rem;
    color: var(--bordeaux-primary);
    font-weight: 700;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 12px;
    text-align: center;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 8px;
    display: block;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--bordeaux-gradient);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:active {
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:active {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:active {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:active {
    background: #218838;
}

.btn-small {
    padding: 10px 16px;
    font-size: 0.875rem;
    width: auto;
    margin-bottom: 0;
}

#cancelBtn {
    display: none;
}

/* ============================================
   TABLE (Mobile: Cards, Desktop: Table)
   ============================================ */
.table-section {
    overflow: visible;
}

table {
    width: 100%;
    border-collapse: collapse;
    display: none;
}

thead {
    background: var(--bordeaux-gradient);
    color: white;
}

th, td {
    padding: 12px;
    text-align: left;
    font-size: 0.875rem;
}

th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
}

tbody tr:last-child {
    border-bottom: none;
}

/* Mobile Cards View */
.stage-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stage-card {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    transition: all 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.stage-card:active {
    transform: scale(0.98);
    border-color: var(--bordeaux-primary);
}

.stage-card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.stage-card-date {
    font-weight: 700;
    color: var(--bordeaux-primary);
    font-size: 1rem;
}

.stage-card-hours {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.stage-card-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.stage-card-detail {
    display: flex;
    flex-direction: column;
}

.stage-card-detail-label {
    color: var(--text-light);
    font-size: 0.75rem;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stage-card-detail-value {
    font-weight: 600;
    color: var(--text-dark);
}

.stage-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid var(--border-color);
}

.stage-card-actions .btn {
    width: 100%;
    margin-bottom: 0;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state p {
    font-size: 0.9rem;
    margin-top: 8px;
    line-height: 1.6;
}

/* ============================================
   EXPORT BUTTONS
   ============================================ */
.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

/* ============================================
   CHARTS
   ============================================ */
.chart-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.chart-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
}

.chart-tab.active {
    color: var(--bordeaux-primary);
    border-bottom-color: var(--bordeaux-primary);
}

.chart-tab:active {
    transform: translateY(1px);
}

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    margin-top: 20px;
}

.chart-container canvas {
    max-width: 100%;
    height: auto;
}

/* ============================================
   ADVANCED STATS
   ============================================ */
.advanced-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-box {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s;
}

.stat-box:active {
    transform: scale(0.98);
    border-color: var(--bordeaux-primary);
}

.stat-box h3 {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bordeaux-primary);
    margin-bottom: 4px;
}

.stat-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 0;
}

.export-buttons .btn {
    margin-bottom: 0;
    font-size: 0.9rem;
    padding: 12px 16px;
}

/* ============================================
   DESKTOP STYLES (Tablet & Up)
   ============================================ */
@media (min-width: 768px) {
    body {
        background: var(--bg-light);
        padding: 20px;
    }

    .container {
        max-width: 900px;
        margin: 0 auto;
        background: var(--bg-white);
        border-radius: 20px;
        box-shadow: var(--shadow);
        overflow: hidden;
    }

    header {
        padding: 32px 40px 0 40px;
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .header-content section {
        text-align: center;
        flex: 1;
    }

    .theme-toggle {
        position: static;
        align-self: auto;
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }

    .main-nav {
        margin-top: 24px;
        padding-top: 16px;
        gap: 8px;
    }

    .nav-btn {
        padding: 14px 20px;
        font-size: 0.9rem;
        gap: 6px;
    }

    .nav-btn span {
        font-size: 1.2rem;
    }

    header h1 {
        font-size: 2.25rem;
    }

    header p {
        font-size: 1.1rem;
    }

    main {
        padding: 32px 40px;
        max-width: 100%;
    }

    .form-section-header,
    .table-section-header,
    .calendar-section-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .stats-section,
    .form-section,
    .settings-section,
    .table-section {
        padding: 28px;
        border-radius: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .stat-card {
        padding: 24px;
    }

    .stat-card .value {
        font-size: 2rem;
    }

    .form-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .form-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn {
        width: auto;
        margin-right: 12px;
        margin-bottom: 0;
    }

    .table-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .search-input,
    .filter-select,
    .sort-select {
        flex: 1;
        min-width: 120px;
        font-size: 0.9rem;
    }

    .export-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .export-buttons .btn {
        flex: 1;
        min-width: 150px;
    }

    .stage-card-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .stage-card-actions {
        flex-direction: row;
    }

    .stage-card-actions .btn {
        flex: 1;
        width: auto;
    }

    .btn-small {
        padding: 8px 16px;
    }

    /* Show table on desktop, hide cards */
    table {
        display: table;
    }

    .stage-cards {
        display: none;
    }

    th, td {
        padding: 16px;
        font-size: 0.95rem;
    }

    .export-buttons {
        display: flex;
        gap: 12px;
    }

    .export-buttons .btn {
        flex: 1;
    }

    .calendar-day {
        min-height: 60px;
        padding: 8px;
    }

    .calendar-day-number {
        font-size: 1rem;
    }

    .calendar-day-hours {
        font-size: 0.75rem;
    }

    .calendar-nav-btn {
        width: 48px;
        height: 48px;
        font-size: 1.75rem;
    }

    .calendar-header h3 {
        font-size: 1.3rem;
    }
}

/* ============================================
   LARGE DESKTOP
   ============================================ */
@media (min-width: 1200px) {
    .container {
        max-width: 1100px;
    }

    .form-row {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   MOBILE OPTIMIZATIONS (< 480px)
   ============================================ */
@media (max-width: 480px) {
    header {
        padding: 16px 12px 0 12px;
    }

    header h1 {
        font-size: 1.4rem;
        margin-bottom: 4px;
    }

    header p {
        font-size: 0.8rem;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
        align-self: flex-end;
    }

    .main-nav {
        gap: 4px;
        margin-top: 16px;
        padding-top: 12px;
    }

    .nav-btn {
        padding: 10px 8px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .nav-btn span {
        font-size: 1rem;
    }

    main {
        padding: 16px 12px;
    }

    .stats-section,
    .form-section,
    .settings-section,
    .table-section,
    .calendar-section,
    .charts-section {
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-card h3 {
        font-size: 0.65rem;
    }

    .stat-card .value {
        font-size: 1.2rem;
    }

    .form-row {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .form-group {
        width: 100%;
    }

    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group select {
        font-size: 1rem; /* Évite le zoom sur iOS */
        padding: 12px;
    }

    .form-actions {
        flex-direction: column;
        gap: 8px;
    }

    .btn {
        width: 100%;
        padding: 14px;
        font-size: 1rem;
    }

    .table-controls {
        flex-direction: column;
        gap: 8px;
    }

    .search-input,
    .filter-select,
    .sort-select {
        width: 100%;
        font-size: 1rem;
        padding: 12px;
    }

    .export-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .export-buttons .btn {
        width: 100%;
    }

    .table-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .table-section-header h2 {
        font-size: 1.2rem;
    }

    .stage-card {
        padding: 16px;
    }

    .stage-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .stage-card-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .advanced-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-box {
        padding: 16px;
    }

    .stat-box h3 {
        font-size: 0.8rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .calendar-grid {
        gap: 4px;
    }

    .calendar-day {
        min-height: 50px;
        padding: 4px;
    }

    .calendar-day-number {
        font-size: 0.85rem;
    }

    .calendar-day-hours {
        font-size: 0.65rem;
    }

    .calendar-header h3 {
        font-size: 1.1rem;
    }

    .calendar-nav-btn {
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }

    .settings-group {
        margin-bottom: 24px;
    }

    .settings-group h3 {
        font-size: 1.1rem;
    }

    .settings-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .settings-buttons .btn {
        width: 100%;
    }
}

/* ============================================
   ACCESSIBILITY - Screen Reader Only
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


