* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.4;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ddd;
}

header h1 {
    font-size: 1.5rem;
    color: #2c3e50;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

#week-selector {
    padding: 8px 12px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.print-btn, .config-btn, .save-btn, .add-btn {
    padding: 8px 16px;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.print-btn {
    background: #3498db;
    color: white;
}

.print-btn:hover {
    background: #2980b9;
}

.pdf-btn {
    background: #e74c3c;
}

.pdf-btn:hover {
    background: #c0392b;
}

.config-btn {
    background: #95a5a6;
    color: white;
}

.config-btn:hover {
    background: #7f8c8d;
}

.save-btn {
    background: #27ae60;
    color: white;
}

.save-btn:hover {
    background: #219a52;
}

.add-btn {
    background: #e74c3c;
    color: white;
    margin-right: 10px;
}

.add-btn:hover {
    background: #c0392b;
}

/* Config panel */
.config-panel {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.config-panel h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.ical-url-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.ical-url-item input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.ical-name {
    width: 150px;
}

.ical-url {
    flex: 1;
}

.remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    cursor: pointer;
}

.remove-btn:hover {
    background: #c0392b;
}

/* Week header */
.week-header {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
}

/* Calendar grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.day-column {
    min-height: 400px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.day-header {
    background: #2c3e50;
    color: white;
    padding: 10px;
    text-align: center;
}

.day-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.day-date {
    display: block;
    font-size: 1.1rem;
    margin-top: 2px;
}

.day-events {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Event cards */
.event-card {
    background: #f8f9fa;
    border-left: 4px solid #95a5a6;
    border-radius: 4px;
    padding: 8px;
    font-size: 0.85rem;
}

.event-card.depart {
    border-left-color: #3498db;
    background: #ebf5fb;
}

.event-card.retour {
    border-left-color: #e74c3c;
    background: #fdedec;
}

.event-header {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    margin-bottom: 5px;
}

.event-time {
    font-weight: 600;
    color: #2c3e50;
}

.event-label {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.event-label.depart {
    background: #3498db;
    color: white;
}

.event-label.retour {
    background: #e74c3c;
    color: white;
}

.event-id {
    color: #7f8c8d;
    font-size: 0.8rem;
}

.event-vehicle {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
}

.event-client {
    color: #666;
    font-size: 0.8rem;
}

/* Print styles */
@page {
    size: 297mm 210mm landscape;
    margin: 8mm;
}

@media print {
    html, body {
        width: 297mm;
        height: 210mm;
        background: white;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color-adjust: exact;
    }

    .no-print {
        display: none !important;
    }

    .container {
        max-width: none;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .week-header {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .calendar-grid {
        box-shadow: none;
        padding: 0;
        gap: 3px;
        width: 100%;
    }

    .day-column {
        min-height: auto;
        break-inside: avoid;
    }

    .day-header {
        padding: 4px;
    }

    .day-name {
        font-size: 0.7rem;
    }

    .day-date {
        font-size: 0.9rem;
    }

    .event-card {
        padding: 4px;
        font-size: 0.7rem;
        break-inside: avoid;
    }

    .event-label {
        font-size: 0.6rem;
        padding: 1px 3px;
    }

    .event-vehicle {
        font-size: 0.7rem;
    }

    .event-client {
        font-size: 0.65rem;
    }
}

/* Responsive adjustments */
@media screen and (max-width: 1024px) {
    .calendar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    header {
        flex-direction: column;
        gap: 15px;
    }

    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media screen and (max-width: 480px) {
    .calendar-grid {
        grid-template-columns: 1fr;
    }
}
