/* Video Calendar Styles */
/* Natural palette:
   soft white #faf7f2 (background), sage #6f8b72 (accent),
   deep green-charcoal #34433a (text), cream #f2ecdf (opened door card) */

body {
    font-family: Arial, sans-serif;
    background-color: #faf7f2;
    margin: 0;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #34433a;
}

.calendar {
    display: grid;
    /* Dynamic column count based on window width:
       1 column on smartphones, up to 4 columns on large screens.
       minmax(290px) sets the minimum door size; the container
       max-width caps the grid at 4 columns (5 x 290px + gaps > 1200px). */
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

.door {
    background-color: #6f8b72;
    color: white;
    text-align: center;
    padding: 15px;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
}

/* Touch devices: no sticky hover scale, no double-tap zoom delay */
@media (hover: none) {
    .door:hover {
        transform: none;
        box-shadow: none;
    }
}

.door:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Opened doors become light cream cards, so their text
   inherits/overrides to dark green-charcoal for readability. */
.door.opened {
    background-color: #f2ecdf;
    color: #3f4a3d;
}

.door.opened .door-number {
    color: #3f4a3d;
}

.door.opened .video-title {
    color: #3f4a3d;
}

.door.locked {
    background-color: #e3e0d8;
    color: #9a968b;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.door-number {
    font-size: 24px;
    font-weight: bold;
}

.video-preview {
    width: 100%;
    height: 60%;
    background-color: #2c2c28;
    margin-top: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    overflow: hidden;
}

.video-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.rating {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.rating button {
    background-color: #ffffff;
    color: #34433a;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.2s;
    touch-action: manipulation;
}

.rating button:hover {
    background-color: #e9e4d8;
}

.rating button.selected {
    background-color: #6f8b72;
    color: #ffffff;
}

.export-button {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background-color: #6f8b72;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.export-button:hover {
    background-color: #5e7561;
}

.video-title {
    margin-top: 5px;
    font-size: 25px;
    line-height: 1.3;
    font-weight: bold;
    color: white;
    text-align: center;
    word-break: break-word;
    /* Height is set dynamically via JS (max title height per calendar row);
       this default keeps the natural content height if JS is unavailable. */
    overflow: hidden;
}

@media (max-width: 768px) {
    .calendar {
        gap: 8px;
    }

    .door {
        padding: 10px;
    }

    .door-number {
        font-size: 15px;
    }

    /* Opened doors become full-width cards, stacked vertically:
       number + title on top, thumbnail full width, rating centered below. */
    .door.opened {
        grid-column: 1 / -1;
        aspect-ratio: auto;
        justify-content: flex-start;
        padding: 12px;
    }

    .door.opened .video-title {
        margin-top: 4px;
        font-size: 17px;
    }

    .door.opened .video-preview {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        margin-top: 8px;
    }

    .door.opened .rating {
        margin-top: 10px;
        justify-content: center;
    }

    .rating button {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .calendar {
        gap: 6px;
    }

    .door {
        padding: 8px;
    }

    .door-number {
        font-size: 16px;
    }

    body {
        padding: 10px;
    }

    h1 {
        font-size: 20px;
    }
}
