/* === GLOBAL STYLES === */
body {
    /* Creamy paper background with texture */
    background-color: #f7e8d8;
    background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
    margin: 0;
    font-family: 'Caveat', cursive; /* Default handwritten font */
    color: #4a4a4a;
    overflow-x: hidden; /* Prevents horizontal scrollbar during transitions */
}

/* === VIEW/PAGE SWITCHING MECHANICS === */
.view {
    display: none; /* Keep this for the internal pages */
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

#cover.view {
    display: flex; /* Force the cover to be display:flex by default */
    opacity: 1;    /* Force it to be visible immediately */
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.view.active {
    display: flex !important;
    opacity: 1;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}


/* === COVER PAGE SPECIFIC STYLES (Restoring Iteration 1) === */

/* Centers the cover card vertically on the first page */
#cover.view.active {
    justify-content: center;
}

/* The main "physical card" container */
.main-card-container {
    background: #fffcf9;
    padding: 50px 40px;
    border-radius: 4px;
    /* Deep shadow to make it pop off the page */
    box-shadow: 10px 15px 35px rgba(0,0,0,0.15), inset 0 0 20px rgba(0,0,0,0.02);
    position: relative;
    max-width: 480px;
    width: 90%;
    text-align: center;
    border: 1px solid #e0d0c0;
    margin: 20px;
}

/* The fancy title font just for the cover */
.main-card-container h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 3.8rem;
    color: #d63384; /* Pink/Red */
    margin: 0 0 30px 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* The specific polaroid style for the cover photo */
.cover-polaroid {
    background: white;
    /* Large bottom padding for the handwritten caption area */
    padding: 12px 12px 60px 12px;
    box-shadow: 2px 8px 20px rgba(0,0,0,0.2);
    transform: rotate(-3deg); /* The characteristic tilt */
    margin: 0 auto 40px auto;
    max-width: 320px;
    transition: transform 0.3s ease;
}

.cover-polaroid:hover {
    transform: rotate(0deg) scale(1.02); /* Straighten slightly on hover */
}

.cover-img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid #eee;
}

.cover-polaroid .caption {
    font-size: 2rem;
    margin-top: 20px;
    color: #555;
    position: absolute;
    bottom: 15px;
    width: 100%;
    left: 0;
    text-align: center;
}

/* Washi Tape decorations */
.tape {
    position: absolute;
    width: 110px;
    height: 35px;
    /* Semi-transparent pink tape */
    background: rgba(214, 51, 132, 0.4);
    backdrop-filter: blur(1px);
    /* CSS trick for jagged tape edges */
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><polygon points="0,0 100%,5% 95%,100% 5%,95%"/></svg>');
}

.top-left { top: -15px; left: -25px; transform: rotate(-40deg); }
.bottom-right { bottom: -15px; right: -25px; transform: rotate(-40deg); }


/* === INNER PAGES (PHOTOS & OREO) STYLES === */

.scrapbook-page-content {
    max-width: 1100px;
    width: 100%;
    padding: 40px 20px;
    text-align: center;
}

.page-title {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    color: #d63384;
    margin: 20px 0 40px 0;
}

/* The Grid Layout */
.gallery-grid {
    display: grid;
    /* Auto-responsive columns */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 40px;
    padding: 20px;
}

/* The smaller polaroids for the grids */
.grid-polaroid {
    background: white;
    padding: 10px 10px 25px 10px; /* Less bottom padding here */
    box-shadow: 3px 5px 15px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    position: relative;
}

.grid-polaroid img {
    width: 100%;
    height: 220px; /* Fixed height for neat grid */
    object-fit: cover;
}

.grid-polaroid:hover {
    /* Pops out and straightens up */
    transform: scale(1.1) rotate(0deg) !important;
    z-index: 10;
    box-shadow: 5px 10px 25px rgba(0,0,0,0.25);
}

/* === SHARED UI ELEMENTS === */

/* Buttons */
.btn {
    background: #d63384;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.6rem;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Caveat', cursive;
    transition: background 0.3s, transform 0.2s;
    box-shadow: 2px 4px 10px rgba(214, 51, 132, 0.3);
}

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

.main-btn {
    font-size: 2rem; /* Larger button for the cover */
    padding: 15px 40px;
}

.back-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Caveat';
    font-size: 1.6rem;
    color: #d63384;
    display: inline-block;
    margin-bottom: 20px;
}

.nav-bottom { margin-top: 60px; }

/* === PERSISTENT MUSIC PLAYER === */
.music-controller {
    position: fixed;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    border: 2px dashed #d63384;
    display: flex;
    align-items: center;
    gap: 10px;
}

#play-indicator { font-size: 1.2rem; }

.track-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#now-playing {
    font-size: 0.9rem;
    color: #d63384;
    margin-bottom: 3px;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Cute pink slider */
#volume-slider {
    -webkit-appearance: none;
    width: 100px;
    height: 4px;
    background: #f1b2d2;
    border-radius: 2px;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #d63384;
    border-radius: 50%;
    cursor: pointer;
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Dark background */
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Above everything else */
    cursor: pointer;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

#lightbox-img {
    max-width: 90%;
    max-height: 80%;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border: 10px solid white; /* Keep the Polaroid feel even when big */
}

.close-lightbox {
    position: absolute;
    top: 30px;
    right: 40px;
    color: white;
    font-size: 3rem;
    font-weight: bold;
    cursor: pointer;
}

/* Add this to your style.css */

.controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
    justify-content: flex-end; /* Keeps it tidy in the corner */
}

.skip-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s ease;
    padding: 0;
    line-height: 1;
}

.skip-btn:hover {
    transform: scale(1.2);
}

.skip-btn:active {
    transform: scale(0.9);
}

/* Popup Overlays */
.valentine-popup, .sad-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f4e1d2; /* Match your scrapbook background color */
    background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000; /* Ensure it covers everything including the music player */
}

.popup-content, .sad-content {
    background: white;
    padding: 50px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
    border: 2px dashed #d63384;
}

.popup-content h2 {
    font-size: 2.5rem;
    color: #d63384;
    margin-bottom: 30px;
}

.popup-btns {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.yes-btn {
    background: #d63384 !important;
    font-size: 1.8rem !important;
    padding: 15px 40px !important;
}

.no-btn {
    background: #888 !important;
    font-size: 1.2rem !important;
    opacity: 0.7;
}

.sad-popup {
    background: #2c3e50; /* A dark, sadder background */
    color: white;
}