:root {
    --bg-color: #fdfbf7;
    --text-color: #4a4a4a;
    --card-bg: #ffffff;

    /* Pastel Palette */
    --pastel-pink: #ffd1dc;
    --pastel-blue: #c1e1ff;
    --pastel-green: #d0f0c0;
    --pastel-yellow: #fdfd96;
    --pastel-purple: #e6e6fa;
    --pastel-orange: #ffdab9;

    --btn-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
    --btn-active-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);

    --font-family: 'Fredoka', 'Nunito', sans-serif;
    /* Playful fonts */
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1,
h2,
h3 {
    margin-top: 0;
    color: #333;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.center-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    max-width: 400px;
    width: 90%;
}

/* Inputs */
input[type="text"],
input[type="email"] {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid #eee;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--pastel-blue);
    outline: none;
}

/* Buttons */
.btn {
    border: none;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    text-decoration: none;
    display: inline-block;
    color: #444;
}

.btn:active {
    transform: translateY(2px);
    box-shadow: var(--btn-active-shadow);
}

.btn-large {
    width: 100%;
    font-size: 1.3rem;
    padding: 20px;
}

.btn-primary {
    background-color: var(--pastel-blue);
    box-shadow: 0 4px 0 #a2c2e0;
}

.btn-secondary {
    background-color: var(--pastel-pink);
    box-shadow: 0 4px 0 #e0b0bb;
}

.btn-accent {
    background-color: var(--pastel-purple);
    box-shadow: 0 4px 0 #c6c6da;
}

/* Dashboard Tabs */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 1.2rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    opacity: 0.6;
}

.tab-btn.active {
    opacity: 1;
    border-bottom-color: var(--text-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.photo-item {
    aspect-ratio: 1;
    background-color: #eee;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Frames List */
.frame-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.frame-item {
    background: white;
    padding: 20px;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}

.frame-item:hover {
    transform: scale(1.02);
}

/* Frame View (Fullscreen) */
.frame-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.frame-view img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Calendar */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.calendar-day-header {
    text-align: center;
    font-weight: bold;
    color: #888;
    padding: 10px 0;
}

.calendar-day {
    aspect-ratio: 1;
    min-width: 0;
    /* Fix for Firefox Grid/Flex items with aspect-ratio */
    background: #fff;
    border-radius: 12px;
    padding: 5px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.1s, box-shadow 0.1s;
    overflow: hidden;
    position: relative;
}

.calendar-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.calendar-day.empty {
    background: transparent;
    box-shadow: none;
    cursor: default;
}

.calendar-day .day-number {
    font-weight: bold;
    font-size: 0.9rem;
}

.calendar-day .event-indicator {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.calendar-day .event-indicator img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}

.calendar-day.has-event .day-number {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    padding: 2px 4px;
    align-self: flex-start;
}

/* Modal Photo Grid Selection */
.selectable-photo {
    cursor: pointer;
    border: 3px solid transparent;
}

.selectable-photo.selected {
    border-color: var(--pastel-blue);
    transform: scale(0.95);
}

/* Frame Text Overlay */
.text-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: black;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-family: var(--font-family);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 90%;
    display: none;
    /* Hidden by default */
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-overlay.open {
    display: flex;
}

.hidden {
    display: none !important;
}


.calendar-day .event-text-preview {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.7rem;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 3;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .container {
        padding: 10px;
        width: 100%;
        /* Ensure container takes full width */
    }

    .calendar-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 3px;
        width: 100%;
        /* Explicit width */
    }

    .calendar-day {
        padding: 2px;
        border-radius: 6px;
        aspect-ratio: 1;
        /* Reinforce */
        min-height: 40px;
        /* Fallback height */
    }

    .calendar-day-header {
        font-size: 0.75rem;
        /* Smaller font */
        padding: 5px 0;
    }

    .calendar-day .day-number {
        font-size: 0.75rem;
        background: rgba(255, 255, 255, 0.9);
        /* More contrast */
    }

    .card {
        padding: 20px;
        width: 100%;
        max-width: 100%;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .calendar-controls select {
        width: 100%;
        margin-bottom: 10px;
    }

    .calendar-controls>div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
}