/* Centrare pagina 4 ca celelalte */
.page-4 {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Buton mic album sub grid */
.album-next-btn {
    background: transparent;
    border: 1px solid #ff4d6d;
    color: #ff4d6d;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Dancing Script';
    font-size: 0.95rem;
    margin-top: 18px;
    align-self: center;
    transition: background 0.2s;
}

.album-next-btn:hover {
    background: #ffe3ec;
}

/* TOATE STILURILE TALE ORIGINALE RĂMÂN NESCHIMBATE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body,
html {
    height: 100%;
    overflow: hidden;
    font-family: 'Playfair Display', serif;
    cursor: url('public/heart.svg') 16 16, auto;
}

button,
a,
.memory-item,
.close-modal,
#scratchCanvas {
    cursor: url('public/heart-hover.svg') 16 16, pointer;
}

.wrapper {
    display: flex;
    width: 500vw;
    height: 100vh;
    background: linear-gradient(135deg, #ffafbd 0%, #ffc3a0 100%);
    transition: transform 1.5s cubic-bezier(0.65, 0, 0.35, 1);
}

.page-1,
.page-2,
.page-3 {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.letter-box {
    background: #ffffff;
    width: 520px;
    height: 800px;
    padding: 40px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    border-radius: 10px;
}

.handmade-style {
    background: #fffcfc !important;
    justify-content: center;
    align-items: center;
}

/* DECORATIUNI */
.glitter-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#ffb3c1 1.2px, transparent 1.2px);
    background-size: 25px 25px;
    opacity: 0.3;
    pointer-events: none;
}

.hand-drawn-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.content-front {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    z-index: 30;
    gap: 36px;
}

.handmade-title {
    color: #7c4dff;
    font-size: 4.5rem;
    font-family: 'Satisfy', cursive;
}

#openBtn {
    background: #ff4d6d;
    color: white;
    border: none;
    padding: 18px 45px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 77, 109, 0.4);
}

.roxy-text {
    position: absolute;
    bottom: 40px;
    right: 40px;
    font-size: 1.8rem;
    color: #ff4d6d;
    transform: rotate(-5deg);
}

/* INIMIOARE (Codul tău intact) */
.css-heart {
    position: absolute;
    width: 28px;
    height: 28px;
    transform: rotate(-45deg);
    z-index: 10;
}

.css-heart::before,
.css-heart::after {
    content: "";
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.css-heart::before {
    top: -14px;
    left: 0;
}

.css-heart::after {
    left: 14px;
    top: 0;
}

.type-solid,
.type-solid::before,
.type-solid::after {
    background-color: currentColor;
}

.type-outline {
    background-color: transparent !important;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}

.type-outline::before {
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
    background: transparent !important;
}

.type-outline::after {
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    background: transparent !important;
}

.color-red {
    color: #e63946;
}

.color-purple {
    color: #9d4edd;
}

.color-orange {
    color: #fb8500;
}

.color-pink {
    color: #ff85a1;
}

.color-purple-dark {
    color: #5a189a;
}

.color-red-bright {
    color: #ff4d6d;
}

.q1 {
    top: 8%;
    left: 12%;
}

.q2 {
    top: 12%;
    right: 15%;
}

.q3 {
    top: 30%;
    left: 10%;
}

.q4 {
    top: 35%;
    right: 12%;
}

.q5 {
    bottom: 15%;
    left: 15%;
}

.q6 {
    bottom: 12%;
    right: 18%;
}

.q7 {
    bottom: 30%;
    left: 12%;
}

.q8 {
    bottom: 35%;
    right: 15%;
}

.q9 {
    top: 5%;
    left: 48%;
}

.q10 {
    bottom: 5%;
    left: 45%;
}

@keyframes shinePulse {

    0%,
    100% {
        transform: rotate(-45deg) scale(1);
    }

    50% {
        transform: rotate(-45deg) scale(1.1);
    }
}

.shine {
    animation: shinePulse 3s infinite ease-in-out;
}

/* PAGINA 2 & 3 STYLE */
.interior {
    background: #fff;
}

.inner-frame {
    border: 2px solid #ffb3c1;
    width: 100%;
    height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Esențial pentru poziționarea absolută a semnăturii și butoanelor */
}

#typewriter {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #444;
    margin-top: 15px;
    font-style: italic;
    white-space: pre-wrap;
    max-height: 65%;
    /* Limitează zona de text să nu se suprapună cu semnătura */
    overflow-y: auto;
    padding-right: 10px;
}

/* Mută semnătura în dreapta jos de tot */
.inner-frame h2 {
    margin-bottom: 10px !important;
    font-size: 1.5rem;
}

/* Semnătura fixată absolut în dreapta jos */
.signature {
    position: absolute;
    bottom: 85px;
    /* Spațiu suficient deasupra butoanelor */
    right: 30px;
    text-align: right;
    font-size: 1.4rem;
    color: #c9184a;
    font-family: 'Dancing Script', cursive;
    line-height: 1.2;
}

/* PAGINA 3 - GRID FARA SCROLLBAR */
.album-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 coloane */
    gap: 10px;
    /* Spațiu mai mic între poze */
    width: 100%;
    margin: 10px 0;
    overflow: hidden;
    /* Forțăm eliminarea scroll-ului */
    flex-grow: 1;
    /* Ocupă spațiul disponibil */
}

.memory-item {
    background: #fff;
    padding: 5px;
    border: 1px solid #eee;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: 0.3s;
}

.memory-item:hover {
    transform: scale(1.05);
    border-color: #ffb3c1;
}

.memory-item img {
    width: 100%;
    height: 110px;
    /* Reducem înălțimea pozelor ca să încapă toate (8 poze) */
    object-fit: cover;
    border-radius: 5px;
    display: block;
}

/* MODAL STRUCTURAT DIFERIT */
#modalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-hidden {
    display: none !important;
}

.modal-card {
    background: white;
    width: 90%;
    max-width: 700px;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.4s ease;
}

.modal-body {
    display: flex;
    flex-direction: row;
}

.modal-img-container {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
}

.modal-img-container img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.modal-details {
    flex: 1;
    padding: 30px;
    background: #fdfaf6;
    border-left: 2px dashed #ffb3c1;
}

.modal-meta {
    font-size: 0.9rem;
    color: #777;
    margin: 5px 0;
}

.modal-divider {
    height: 1px;
    background: #ffb3c1;
    margin: 15px 0;
}

.modal-long-text {
    font-size: 1.2rem;
    color: #444;
    line-height: 1.5;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 35px;
    cursor: pointer;
    color: #ff4d6d;
    z-index: 5;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* CLASE NAVIGARE */
.active-page-2 {
    transform: translateX(-100vw);
}

.active-page-3 {
    transform: translateX(-200vw);
}

.dancing-script {
    font-family: 'Dancing Script', cursive;
}

.active-page-4 {
    transform: translateX(-300vw);
}

.page-5 {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.active-page-5 {
    transform: translateX(-400vw);
}

/* Scratch Card Styles */
.scratch-container {
    position: relative;
    width: 300px;
    height: 400px;
    border: 5px solid #ffb3c1;
    border-radius: 15px;
    overflow: hidden;
    background: #eee;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.scratch-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#scratchCanvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    touch-action: none;
    /* Important pentru mobile */
}

/* Contenedor para alinear botones: uno a cada lado */
.nav-buttons {
    position: absolute;
    bottom: 15px;
    /* Mai aproape de marginea de jos */
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
}

/* Aseguramos que las páginas ocupen el ancho total exacto */
.page-1,
.page-2,
.page-3,
.page-4,
.page-5 {
    flex-shrink: 0;
    /* Evita que las páginas se encojan y se vea "media página" */
}

/* Ajuste pentru eliminare scroll albume */
.album-grid {
    flex-grow: 1;
    overflow-y: hidden !important;
    /* Dezactivează scroll-ul vertical */
    max-height: 520px;
    /* Ajustează înălțimea pentru a lăsa loc butoanelor */
}

.memory-item img {
    height: 105px !important;
    /* Forțează o înălțime fixă mai mică pentru a încape 8 poze (4 rânduri) */
}

.handmade-next {
    background: white !important;
    /* Fundal alb curat */
    border: 1px solid #ff4d6d !important;
    /* Contur roz subțire */
    color: #ff4d6d !important;
    /* Text roz */
    padding: 4px 12px !important;
    border-radius: 25px !important;
    /* Formă de capsulă */
    cursor: pointer;
    font-family: 'Dancing Script', cursive;
    font-size: 0.85rem !important;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.handmade-next:hover {
    background: #ffe3ec !important;
    /* Efect subtil la hover */
    transform: scale(1.05);
}

/* --- AJUSTĂRI FINALE PENTRU CENTRARE ȘI MOBIL --- */

/* --- CORECTARE GRID ALBUM MOBIL (2 PE RÂND, 4 RÂNDURI) --- */

@media (max-width: 600px) {
    /* Ajustăm scrisoarea să fie mai înaltă pe ecran pentru a lăsa loc pozelor */
    .letter-box {
        height: 88vh !important;
        margin-top: -108px !important; /* O urcăm mai sus pe ecran */
    }

    .album-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; /* 2 coloane */
        grid-template-rows: repeat(4, 1fr) !important;    /* 4 rânduri egale */
        gap: 8px !important;
        max-height: 70% !important; /* Ocupă mai mult spațiu vertical */
        overflow: hidden !important;
    }

    .memory-item {
        height: auto !important;
    }

    .memory-item img {
        /* Calculăm înălțimea astfel încât 4 rânduri să încapă perfect */
        height: 85px !important; 
        width: 100% !important;
        object-fit: cover !important;
        border-radius: 5px !important;
    }

    /* Reducem marginea titlului din album ca să câștigăm spațiu */
    .page-3 h2, .page-4 h2 {
        margin-bottom: 10px !important;
        font-size: 1.4rem !important;
    }

    /* Repoziționăm butoanele să nu acopere ultimul rând de poze */
    .nav-buttons {
        position: absolute !important;
        bottom: 10px !important;
        padding-top: 5px !important;
    }
}

/* Ajustare specială pentru iPhone-uri foarte mici (SE, 7, 8) */
@media (max-height: 670px) {
    .memory-item img {
        height: 75px !important; /* Poze și mai mici pe ecrane foarte scunde */
    }
    .letter-box {
        height: 92vh !important;
    }
}