/**
 * Calendrier Scolaire Français v1.0
 * Styles CSS responsifs avec font Montserrat
 * 
 * Structure:
 * - Reset et styles de base
 * - Layout principal (header, container, footer)
 * - Tableau des vacances scolaires
 * - Tableau des jours fériés  
 * - Tableau d'optimisation des ponts
 * - Responsive design mobile/desktop
 * - Animations et accessibilité
 */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Main content */
main {
    margin-bottom: 3rem;
}

/* Calendar section */
.calendar-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 3rem;
}

/* Year tabs */
.year-tabs {
    display: flex;
    justify-content: center;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.year-tabs::-webkit-scrollbar {
    display: none;
}

.tab-button {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    min-width: 120px;
}

.tab-button:hover {
    background: #e2e8f0;
    color: #334155;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

/* Calendar content */
.calendar-content {
    padding: 2rem;
}

.calendar-year {
    display: none;
}

.calendar-year.active {
    display: block;
}

/* Year title */
.year-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
    margin-bottom: 2rem;
}

/* Calendar table */
.calendar-table {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Table header */
.table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.period-column {
    padding: 1rem 1.5rem;
    font-weight: 700;
    color: #374151;
    background: #f1f5f9;
    border-right: 1px solid #e2e8f0;
}

.zone-column {
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    color: white;
    font-size: 0.95rem;
}

.zone-column.zone-a {
    background: #f97316; /* Orange */
}

.zone-column.zone-b {
    background: #3b82f6; /* Blue */
}

.zone-column.zone-c {
    background: #84cc16; /* Green */
}

/* Table rows */
.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

.table-row:hover {
    background: #f8fafc;
}

.table-row.school-start {
    background: #f0fdf4;
    border-left: 4px solid #16a34a;
}

.table-row.school-end {
    background: #fefce8;
    border-left: 4px solid #f59e0b;
}

.table-row.bridge-day {
    background: #f0f9ff;
    border-left: 4px solid #0ea5e9;
}

/* Table cells */
.period-cell {
    padding: 1.25rem 1.5rem;
    background: #fafafa;
    border-right: 1px solid #e2e8f0;
}

.period-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.period-year {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.zone-cell {
    padding: 1.25rem 1rem;
    text-align: center;
    border-right: 1px solid #e2e8f0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #374151;
}

.zone-cell:last-child {
    border-right: none;
}

/* Holidays section */
.holidays-section {
    margin-top: 3rem;
}

.holidays-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #7c3aed;
    text-align: center;
    margin-bottom: 1.5rem;
}

.holidays-table {
    border-top: 3px solid #7c3aed;
}

.holidays-header {
    display: grid;
    grid-template-columns: 2fr 1fr !important;
    background: #f3e8ff;
}

.holiday-name-column {
    padding: 1rem 1.5rem;
    font-weight: 700;
    color: #6b21a8;
    background: #e9d5ff;
    border-right: 2px solid #c084fc;
}

.holiday-date-column {
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    color: #6b21a8;
    background: #e9d5ff;
}

.holiday-row {
    display: grid;
    background: #faf5ff;
    border-left: 4px solid #7c3aed;
    grid-template-columns: 2fr 1fr;
    border-bottom: 1px solid #e2e8f0;
}

.holiday-row:hover {
    background: #f3e8ff;
}

.holiday-name-cell {
    padding: 1.25rem 1.5rem;
    background: #f8faff;
    border-right: 2px solid #d8b4fe;
}

.holiday-date-cell {
    padding: 1.25rem 1rem;
    text-align: center;
    border-right: none;
    color: #581c87;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Bridge optimization section */
.bridge-section {
    margin-top: 3rem;
}

.bridge-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #059669;
    text-align: center;
    margin-bottom: 1.5rem;
}

.bridge-table {
    border-top: 3px solid #059669;
}

.bridge-table .table-header {
    background: #ecfdf5;
    grid-template-columns: 2fr 1.5fr 1fr 2.5fr;
}

.bridge-table .period-column,
.bridge-holiday-column {
    background: #d1fae5;
    color: #065f46;
}

.bridge-date-column,
.bridge-day-column,
.bridge-optimization-column {
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    color: #065f46;
    background: #d1fae5;
    border-right: 1px solid #a7f3d0;
}

.bridge-row {
    background: #f0fdf4;
    border-left: 4px solid #059669;
    grid-template-columns: 2fr 1.5fr 1fr 2.5fr;
}

.bridge-row:hover {
    background: #ecfdf5;
}

.bridge-cell {
    padding: 1.25rem 1rem;
    border-right: 1px solid #a7f3d0;
    color: #065f46;
}

.bridge-cell:last-child {
    border-right: none;
}

.bridge-holiday-cell {
    background: #f7fee7;
}

.bridge-holiday-name {
    font-weight: 600;
    color: #166534;
    font-size: 0.95rem;
}

.bridge-holiday-type {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
    font-style: italic;
}

.bridge-date-cell {
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.4;
}

.bridge-day-cell {
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.bridge-optimization-cell {
    text-align: left;
}

.bridge-type {
    font-weight: 600;
    color: #166534;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.bridge-recommendation {
    font-size: 0.85rem;
    color: #059669;
    line-height: 1.3;
}

/* Bridge type specific styling */
.bridge-monday {
    border-left-color: #f59e0b !important;
}

.bridge-monday .bridge-type {
    color: #d97706;
}

.bridge-friday {
    border-left-color: #3b82f6 !important;
}

.bridge-friday .bridge-type {
    color: #2563eb;
}

.bridge-weekend {
    border-left-color: #10b981 !important;
}

.bridge-weekend .bridge-type {
    color: #059669;
}

.bridge-none {
    border-left-color: #6b7280 !important;
}

.bridge-none .bridge-type {
    color: #6b7280;
}

.bridge-none .bridge-recommendation {
    color: #9ca3af;
}

/* Fixed vs Variable holiday styling */
.bridge-fixed {
    opacity: 0.85;
}

.bridge-fixed .bridge-holiday-type {
    color: #92400e;
}

.bridge-variable .bridge-holiday-type {
    color: #059669;
    font-weight: 500;
}

.no-events {
    text-align: center;
    color: #94a3b8;
    font-style: italic;
    padding: 3rem;
    font-size: 1.1rem;
}

.no-data-message {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

.no-data-message h2 {
    font-size: 1.8rem;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

.no-data-message p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* SEO content section */
.seo-content {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.seo-content h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
    text-align: center;
}

.seo-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #475569;
}

.seo-text strong {
    color: #667eea;
    font-weight: 600;
}

/* Footer */
footer {
    background: #1e293b;
    color: #94a3b8;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 0 0.5rem;
    }
    
    .calendar-content {
        padding: 1rem 0.5rem;
    }
    
    .year-title {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    /* Mobile table layout */
    .table-header {
        grid-template-columns: 1.8fr 1fr 1fr 1fr;
        font-size: 0.8rem;
    }
    
    .table-row {
        grid-template-columns: 1.8fr 1fr 1fr 1fr;
    }
    
    .period-column,
    .period-cell {
        padding: 0.75rem 0.5rem;
    }
    
    .zone-column,
    .zone-cell {
        padding: 0.75rem 0.2rem;
        font-size: 0.7rem;
        text-align: center;
    }
    
    .period-name {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .period-year {
        font-size: 0.7rem;
    }
    
    /* Holidays table mobile */
    .holidays-header {
        grid-template-columns: 2.2fr 1fr !important;
        font-size: 0.8rem;
    }
    
    .holiday-name-column,
    .holiday-date-column {
        padding: 0.75rem 0.5rem;
    }
    
    .holiday-row {
        grid-template-columns: 2.2fr 1fr !important;
    }
    
    .holiday-name-cell,
    .holiday-date-cell {
        padding: 0.75rem 0.5rem;
    }
    
    .holiday-date-cell {
        font-size: 0.7rem;
        text-align: center;
    }
    
    /* Bridge table mobile - improved layout */
    .bridge-table .table-header {
        grid-template-columns: 2fr 1fr 0.7fr 1.8fr !important;
        font-size: 0.75rem;
    }
    
    .bridge-row {
        grid-template-columns: 2fr 1fr 0.7fr 1.8fr;
    }
    
    .bridge-holiday-column,
    .bridge-date-column,
    .bridge-day-column,
    .bridge-optimization-column {
        padding: 0.6rem 0.3rem;
        font-size: 0.7rem;
    }
    
    .bridge-cell {
        padding: 0.6rem 0.3rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .bridge-holiday-name {
        font-size: 0.75rem;
        line-height: 1.2;
        word-wrap: break-word;
    }
    
    .bridge-holiday-type {
        font-size: 0.6rem;
        margin-top: 0.2rem;
    }
    
    .bridge-date-cell {
        font-size: 0.65rem;
        text-align: center;
        line-height: 1.1;
    }
    
    .bridge-day-cell {
        font-size: 0.65rem;
        text-align: center;
    }
    
    .bridge-type {
        font-size: 0.7rem;
        line-height: 1.2;
        margin-bottom: 0.2rem;
    }
    
    .bridge-recommendation {
        font-size: 0.6rem;
        line-height: 1.2;
        word-wrap: break-word;
    }
    
    .seo-content {
        padding: 1.5rem;
    }
    
    .seo-content h2 {
        font-size: 1.5rem;
    }
    
    .seo-text p {
        font-size: 1rem;
    }
    
    .tab-button {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 0;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    .container {
        padding: 0 0.3rem;
    }
    
    .calendar-content {
        padding: 0.75rem 0.3rem;
    }
    
    .year-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    /* Very small screen table adjustments */
    .table-header {
        grid-template-columns: 1.5fr 0.8fr 0.8fr 0.8fr;
        font-size: 0.7rem;
    }
    
    .table-row {
        grid-template-columns: 1.5fr 0.8fr 0.8fr 0.8fr;
    }
    
    .period-column,
    .period-cell {
        padding: 0.5rem 0.4rem;
    }
    
    .zone-column,
    .zone-cell {
        padding: 0.5rem 0.15rem;
        font-size: 0.65rem;
        line-height: 1.1;
        text-align: center;
    }
    
    .period-name {
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    .period-year {
        font-size: 0.65rem;
    }
    
    /* Holidays table very small screens */
    .holidays-header {
        grid-template-columns: 2fr 1fr !important;
        font-size: 0.7rem;
    }
    
    .holiday-row {
        grid-template-columns: 2fr 1fr !important;
    }
    
    .holiday-name-column,
    .holiday-date-column {
        padding: 0.5rem 0.4rem;
    }
    
    .holiday-name-cell,
    .holiday-date-cell {
        padding: 0.5rem 0.4rem;
    }
    
    .holiday-date-cell {
        font-size: 0.65rem;
    }
    
    /* Bridge table very small screens */
    .bridge-table .table-header {
        grid-template-columns: 1.8fr 0.8fr 0.6fr 1.5fr !important;
        font-size: 0.65rem;
    }
    
    .bridge-row {
        grid-template-columns: 1.8fr 0.8fr 0.6fr 1.5fr;
    }
    
    .bridge-holiday-column,
    .bridge-date-column,
    .bridge-day-column,
    .bridge-optimization-column {
        padding: 0.5rem 0.2rem;
        font-size: 0.6rem;
    }
    
    .bridge-cell {
        padding: 0.5rem 0.2rem;
    }
    
    .bridge-holiday-name {
        font-size: 0.65rem;
        line-height: 1.1;
    }
    
    .bridge-holiday-type {
        font-size: 0.55rem;
    }
    
    .bridge-date-cell {
        font-size: 0.6rem;
        line-height: 1.1;
    }
    
    .bridge-day-cell {
        font-size: 0.6rem;
    }
    
    .bridge-type {
        font-size: 0.6rem;
        line-height: 1.1;
        margin-bottom: 0.1rem;
    }
    
    .bridge-recommendation {
        font-size: 0.55rem;
        line-height: 1.1;
    }
    
    .tab-button {
        padding: 0.6rem 0.4rem;
        font-size: 0.75rem;
        min-width: 70px;
    }
}

/* Loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calendar-year.active .table-row {
    animation: fadeIn 0.3s ease-out;
}

/* Focus styles for accessibility */
.tab-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    header {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
    }
    
    .tab-button {
        display: none;
    }
    
    .calendar-year {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .table-row {
        break-inside: avoid;
    }
    
    .calendar-table {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .table-row {
        border-width: 2px;
    }
    
    .tab-button.active {
        border-bottom-width: 4px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}