:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --border-color: #e1e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

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

header {
    text-align: center;
    padding: 30px 0;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1em;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.team-filters h3,
.legend h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.1em;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.filter-btn.active {
    border-width: 2px;
    font-weight: 600;
}

/* Inactive state: grijze weergave voor uitgezette teams */
.filter-btn:not(.active) {
    background: #f5f5f5;
    color: #999;
    opacity: 0.6;
}

.filter-btn:not(.active) .color-indicator {
    background-color: #ccc !important;
    opacity: 0.5;
}

.filter-btn:not(.active):hover {
    opacity: 0.8;
    background: #f0f0f0;
}

.color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: inline-block;
}

.view-controls {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    background: var(--background);
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.btn-primary:hover {
    background: #2980b9;
    border-color: #2980b9;
}

#calendar {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.legend {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 6px;
    background: var(--background);
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-text {
    font-size: 0.95em;
}

.legend-name {
    font-weight: 600;
    display: block;
}

.legend-full {
    color: #7f8c8d;
    font-size: 0.9em;
}

footer {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 0.9em;
}

footer a {
    color: var(--secondary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* FullCalendar customization */
.fc {
    font-size: 0.95em;
}

.fc .fc-button {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    text-transform: capitalize;
}

.fc .fc-button:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.fc .fc-button-active {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.fc-event {
    border-radius: 4px;
    padding: 2px 4px;
    cursor: pointer;
}

.fc-event:hover {
    opacity: 0.8;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 1.5em;
    margin: 0;
    padding-right: 20px;
    line-height: 1.3;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background-color: var(--background);
    color: var(--primary-color);
}

.modal-body {
    padding: 25px;
}

.modal-team {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px;
    background-color: var(--background);
    border-radius: 8px;
}

.modal-team-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.modal-team-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.05em;
}

.modal-detail {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-detail strong {
    display: block;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.modal-detail span,
.modal-detail div {
    color: var(--text-color);
}

#modalDescription {
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: var(--background);
    padding: 12px;
    border-radius: 6px;
    margin-top: 5px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 15px;
    }

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

    .btn {
        font-size: 0.9em;
        padding: 8px 15px;
    }

    .filter-btn {
        font-size: 0.85em;
        padding: 6px 12px;
    }

    .legend-items {
        grid-template-columns: 1fr;
    }

    .legend,
    .controls {
        margin-bottom: 20px;
    }

    #calendar {
        padding: 10px;
    }

    /* FullCalendar mobile improvements */
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }

    .fc .fc-button {
        padding: 6px 10px;
        font-size: 0.85em;
    }

    /* Modal responsive */
    .modal.show {
        padding: 15px;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 1.3em;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 15px 20px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 15px 10px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    .controls {
        padding: 12px;
    }

    .btn {
        font-size: 0.85em;
        padding: 8px 12px;
    }

    .filter-btn {
        font-size: 0.8em;
        padding: 6px 10px;
    }

    .view-controls {
        width: 100%;
    }

    .view-controls .btn {
        flex: 1;
        min-width: 0;
    }

    #calendar {
        padding: 5px;
    }

    .legend,
    .controls {
        padding: 12px;
    }

    .legend-item {
        padding: 8px;
    }

    .fc .fc-button {
        padding: 5px 8px;
        font-size: 0.8em;
    }

    .fc {
        font-size: 0.85em;
    }

    /* Modal extra small */
    .modal.show {
        padding: 10px;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-header h2 {
        font-size: 1.2em;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 12px 15px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}
