html, body {
    height: 100%;
    margin: 0;
    overflow: hidden; /* Voorkom dubbele scrollbars op de hele pagina */
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

/* De witte box */
.modal-box {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.modal-form label {
    font-weight: bold;
    font-size: 0.9rem;
    color: #333;
}

.modal-form input, .modal-form textarea {
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.modal-form textarea {
    min-height: 80px;
    resize: vertical;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.nav-arrow-inline {
    background: #f0faff !important;
    border: 1px solid #e0f2fe !important;
    color: #54c3ea !important;
    border-radius: 8px;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-arrow-inline:hover {
    background: #54c3ea !important;
    color: white !important;
}

.nav-arrow-inline.prev {
    margin-right: 5px;
}

.nav-arrow-inline.next {
    margin-left: 5px;
}

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

/* Container & Layout */
.planning-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 15px;
    box-sizing: border-box;
}

.planning-header {
    display: flex;
    justify-content: space-between; /* Naam links, buttons rechts */
    align-items: center;
    background: white;
    padding: 20px 30px;
    border-radius: 20px;
}

.planning-header-buttons-container {
    display: flex; /* Altijd flex op desktop */
    flex-direction: row;
    gap: 15px;
    width: auto; /* Zorg dat het niet de hele breedte pakt */
}

/* Alle Knoppen (inclusief import) */
.new-planning-item-btn,
.import-template-button,
.btn-primary,
.modal-buttons button[type="submit"] {
    background-color: #54c3ea;
    color: white;
    border: 1px solid #54c3ea;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(84, 195, 234, 0.2);
    white-space: nowrap;
}

.today-button {
    background-color: white;
    color: #54c3ea;
    border: 2px solid #54c3ea;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.today-button:hover {
    background-color: #f0faff;
    transform: translateY(-2px);
}

.new-planning-item-btn:hover, .import-template-button:hover, .btn-primary:hover {
    background-color: white;
    color: #54c3ea;
    transform: translateY(-2px);
}

/* Agenda Grid - Correcte uitlijning */
.time-grid {
    display: grid !important;
    grid-template-columns: 1fr;
    grid-template-rows: 60px repeat(18, 60px);
    background: #fdfdfe;
    border-right: 1px solid #eee;
}

.time-label {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

/* Agenda Grid Container */
.planning-content-area {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 80px 1fr;
    overflow-y: auto;
    background: white;
    border-radius: 15px;
    border: 1px solid #eee;
}

.calendar-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    position: relative;
    min-width: 1000px; /* Forceer een minimale breedte zodat dagen niet te smal worden */
}



.day-header {
    height: 60px;
    display: flex !important; /* Forceer flex */
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 5px;
    background: white;
    width: 100%;
    box-sizing: border-box;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.day-header:hover {
    background-color: #f0faff;
}

.day-header.can-paste {
    border: 2px dashed #54c3ea;
    background-color: #faffff;
}

.day-header span {
    font-weight: 800;
    font-size: 0.95rem;
    color: #333;
    flex-grow: 1;
    text-align: center;
    white-space: nowrap;
    display: inline-block;
}

/* HUIDIGE DAG HIGHLIGHT */
.day-column.is-today {
    background-color: rgba(84, 195, 234, 0.05);
}
.day-column.is-today .day-header {
    color: #54c3ea;
    border-bottom: 3px solid #54c3ea;
}

.day-column {
    position: relative;
    border-right: 1px solid #f5f5f5;
    min-height: 1080px; /* 18 uur * 60px */
}


.planning-item-block {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    transition: all 0.2s ease;
    left: 4px;
    right: 4px;
    background: linear-gradient(135deg, #54c3ea 0%, #48b2d6 100%);
    color: white;
    padding: 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 10;
    overflow: hidden;
}

.edit-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    cursor: pointer;
    color: white;
}

.planning-item-block:hover .edit-icon {
    opacity: 1;
}

.edit-icon:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* Navigatie pijltjes styling */
.nav-arrow-inline:disabled {
    color: #ccc !important;
    cursor: not-allowed;
    opacity: 0.4;
    transform: none !important;
}

.current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #ff4757;
    z-index: 1000; /* Zorg dat dit hoog genoeg is */
    pointer-events: none;
}

/* De Modals - Volledig gestyled */
.modal-box {
    border-radius: 20px;
    padding: 30px;
    border: none;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.modal-form input, .modal-form textarea {
    border: 2px solid #f0f0f0;
    padding: 12px;
    border-radius: 10px;
    transition: border-color 0.3s;
}

.modal-form input:focus {
    border-color: #54c3ea;
    outline: none;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

/* Annuleren knop */
.modal-buttons .btn-secondary,
.modal-buttons button:not(.btn-primary):not(.btn-danger) {
    background-color: #f1f3f5;
    color: #495057;
}

.modal-buttons button:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

/* Verwijderen knop in modal */
.modal-buttons .btn-danger {
    background-color: #ff4757;
    color: white;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.2);
}

.detail-row {
    margin-bottom: 15px;
}

.detail-row label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #888;
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

.detail-row p {
    margin: 0;
    font-size: 1rem;
    color: #2d3436;
    line-height: 1.4;
}

.modal-footer-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    width: 100%;
}

/* Algemene actieknop styling in de detail modal */
.btn-detail-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

/* Specifieke kleuren voor Edit en Copy in landscape modal */
.btn-edit-landscape {
    background-color: #f1f3f5;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-copy-landscape {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.btn-detail-action:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.btn-close-detail {
    flex: 1.5; /* Sluiten knop iets breder maken voor balans */
}

/* Detail tekst styling */
.modal-content-details {
    margin-top: 15px;
    text-align: left;
}

.item-time-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    opacity: 0.9;
    margin-bottom: 2px; /* Kleine ruimte onder de tijd */
    width: 100%;
}

.item-name {
    display: block;
    font-weight: 800;
    font-size: 0.85rem;
    margin-bottom: 4px; /* Kleine ruimte onder de naam */
    text-align: left;
    width: 100%;
}

.item-description-preview {
    margin: 0;
    width: 100%;
}

.input-wrapper-modal {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px; /* Ruimte tussen de blokjes */
    width: 100%;
}

.modal-box .error-message {
    min-height: 1rem; /* Voorkom 'springen' van de layout als de tekst verschijnt */
    margin-bottom: 0;
}

.modal-box .info-input {
    padding: 10px 12px !important; /* Geen iconen nodig in modal, dus minder padding links */
}

select.info-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Color Picker Styling */
input[type="color"].info-input {
    padding: 5px;
    height: 45px;
    cursor: pointer;
    border: 2px solid #f0f0f0;
    background: white;
}

/* Contrast verbetering voor items met categorie */
.planning-item-block {
    border-left: 4px solid rgba(0,0,0,0.15); /* Subtiele schaduwrand links */
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Specifieke styling voor de "Nieuwe Categorie" optie in de select */
select.info-input option[value="NEW"] {
    background-color: #f0faff;
    font-weight: bold;
    color: #54c3ea;
}

/* Detail Modal Categorie Badge */
.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Z-index fix voor modals over modals */
.modal-overlay[style*="z-index: 3000"] {
    background: rgba(0, 0, 0, 0.4); /* Iets lichtere overlay voor de tweede modal */
}

/* Animatie voor nieuwe items */
@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.planning-item-block.reveal {
    opacity: 0; /* Begint onzichtbaar voor de animatie */
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s;
}

.planning-item-block.reveal.active {
    opacity: 1 !important; /* Moet zichtbaar worden */
    transform: scale(1);
}

.category-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 50px; /* Pilvormig */
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}

.section-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.4rem;
    color: #2d3436;
}

.planning-nav {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.cat-option-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cat-color-badge {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
    margin-right: 8px;
    border: 1px solid rgba(0,0,0,0.1);
}

.filter-dropdown-container {
    position: relative;
    display: inline-block;
}

.filter-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-radius: 12px;
    padding: 10px;
    display: none;
    z-index: 2000;
    min-width: 180px;
    margin-top: 10px;
}

.filter-menu.show {
    display: block;
}

.filter-checkbox {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #54c3ea; /* Kleur van de checkbox als deze is aangevinkt */
    flex-shrink: 0;
}

.filter-item {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    transition: background 0.2s;
    user-select: none;
}

.filter-item:hover {
    background: #f8fafc;
}

.filter-dot {
    margin-top: 4px;
    flex-shrink: 0;
}

.filter-item span {
    white-space: nowrap;      /* Forceer tekst op één regel */
    overflow: hidden;         /* Verberg wat buiten het vakje valt */
    text-overflow: ellipsis;  /* Voeg de automatische ... toe */
    max-width: 180px;         /* Stel een breedte in waarbij hij moet afknippen */
    display: inline-block;
    vertical-align: middle;
}

.all-items-option {
    font-style: italic;
    color: #64748b;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 5px;
}

/* Zorg dat iconen rechts blijven staan */
.filter-item div {
    display: flex;
    align-items: center;
}

.del-cat-icon {
    margin-left: auto;
    color: #ccc;
    padding: 5px;
    transition: color 0.2s, transform 0.2s;
}

.del-cat-icon:hover {
    color: #ff4757;
    transform: scale(1.2);
}

/* De dropdown knop in de header */
.filter-toggle-btn {
    background-color: white;
    color: #54c3ea;
    border: 2px solid #54c3ea;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-toggle-btn:hover {
    background-color: #f0faff;
}

.filter-toggle-btn::after {
    content: '\f0d7'; /* FontAwesome caret down */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

select.info-input option {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 10px;
}

.edit-cat-icon {
    color: #a0aec0;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px;
    transition: color 0.2s, transform 0.2s;
}

.edit-cat-icon:hover {
    color: #54c3ea; /* Jouw themakleur */
    transform: scale(1.15);
}

.filter-search-wrapper {
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-search-input {
    width: 100%;
    padding: 8px 30px 8px 12px; /* Extra ruimte rechts voor het kruisje */
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
}

.search-reset-btn {
    position: absolute;
    right: 10px;
    color: #cbd5e0;
    cursor: pointer;
    display: none; /* Standaard verborgen */
    transition: color 0.2s;
    font-size: 0.8rem;
}

.search-reset-btn:hover {
    color: #ff4757;
}

.filter-item.hidden {
    display: none;
}

.copy-icon {
    position: absolute;
    top: 8px;
    right: 40px; /* Naast de edit icon */
    background: rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    cursor: pointer;
}

.planning-item-block:hover .copy-icon {
    opacity: 1;
}

.planning-name-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.title-input-error {
    border: 2px solid #ff4757 !important;
    background-color: #fff5f5 !important;
}

.inline-error-msg {
    color: #ff4757;
    font-size: 0.85rem;
    font-weight: bold;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    animation: fadeIn 0.2s ease;
}

/* ===== RESPONSIVE DESIGN ===== */

/* IPAD & Tablets (max 1024px) */
@media (max-width: 1024px) {
    .planning-content-area {
        grid-template-columns: 50px 1fr;
    }
    .planning-name { font-size: 1.5rem; }
}

/* MOBIEL (max 768px) */
@media (max-width: 768px) {
    .planning-content-area {
        grid-template-columns: 50px 1fr;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .calendar-container {
        grid-template-columns: 1fr !important; /* Forceer 1 kolom */
        min-width: 0 !important;
        width: 100%;
    }

    /* VERBERG alle dagen standaard op mobiel */
    .day-column {
        display: none !important;
    }

    /* TOON alleen de actieve dag */
    .day-column.active-day {
        display: block !important;
        width: 100% !important;
    }

    /* Zorg dat de header van die ene dag de volle breedte pakt */
    .day-header {
        width: 100%;
        display: flex !important;
        justify-content: space-between;
        padding: 0 10px;
    }

    .day-header span {
        font-size: 0.9rem;
    }

    .planning-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .planning-header-buttons-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 2x2 grid op mobiel */
        width: 100%;
        margin-top: 20px; /* De gevraagde margin tussen titel en buttons */
    }

    .planning-header-buttons-container button,
    .filter-dropdown-container {
        width: 100%;
        padding: 10px 5px; /* Iets compacter op mobiel */
        font-size: 0.8rem;
    }

    .filter-item span {
        max-width: 70vw;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .planning-header-buttons-container {
        display: flex; /* Terug naar rij op desktop */
        width: auto;
    }
    .calendar-container {
        grid-template-columns: repeat(7, 1fr) !important;
        min-width: 900px; /* Zorgt dat dagen op iPad leesbaar blijven via horizontale scroll */
    }
    .day-column {
        display: block !important;
    }
}

@media (max-width: 1180px) and (orientation: landscape) {
    html, body {
        height: auto !important;
        overflow-y: auto !important;
    }

    .planning-container {
        height: auto !important;
        min-height: 100%;
        padding-bottom: 50px; /* Extra witruimte onderaan om 23:00 goed te bereiken */
    }

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

    .planning-name {
        font-size: 1.4rem;
    }

    /* De content area moet goed kunnen scrollen */
    .planning-content-area {
        height: auto !important;
        overflow: visible !important; /* Voorkom dat de grid de scroll blokkeert */
    }

    /* Verklein de urenhoogte een beetje om meer overzicht te houden */
    .time-label, .day-header {
        height: 50px;
    }

    .time-grid {
        grid-template-rows: 50px repeat(18, 50px);
    }

    .day-column {
        min-height: 1000px !important;
    }

    /* Pas de top-berekening in JS aan als je deze 50px gebruikt,
       of houd het op 60px als je de witruimte niet erg vindt. */

    .planning-header-buttons-container {
        gap: 8px;
    }

    .new-planning-item-btn, .import-template-button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .edit-icon, .copy-icon {
        display: none !important;
    }

    /* Zorg dat de modal breed genoeg is voor de nieuwe knoppen */
    .modal-box {
        max-width: 500px;
    }
}

@media (max-width: 1024px) {
    .edit-icon, .copy-icon {
        opacity: 1 !important;
        top: auto !important; /* Reset de top positie */
        bottom: 8px !important; /* Plaats onderaan */
        background: rgba(255, 255, 255, 0.4) !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    .edit-icon {
        right: 8px !important;
    }

    .copy-icon {
        right: 42px !important; /* Naast het edit icoon */
    }

    /* Extra margin tussen titel en knoppen */
    .planning-header-buttons-container {
        margin-top: 20px;
    }
}
