/* Hiệu ứng nền giấy */
.paper-texture {
    background-image: url('https://www.transparenttextures.com/patterns/cream-paper.png');
}

/* Chữ màu vàng kim loại (Gradient Text) */
.text-gold-gradient {
    background: linear-gradient(to right, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0px 2px 4px rgba(0,0,0,0.1);
}

/* Lưới lịch */
.calendar-grid div {
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Animation quay chậm cho icon nhạc */
.animate-spin-slow {
    animation: spin 5s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Cánh hoa rơi */
.petal {
    position: absolute;
    background-color: #ffd1dc; /* Màu hồng phấn */
    border-radius: 150% 0 150% 0;
    animation: falling 10s linear infinite;
    opacity: 0.6;
    z-index: 5;
}

@keyframes falling {
    0% { transform: translate(0, -10vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.8; }
    100% { transform: translate(20px, 100vh) rotate(720deg); opacity: 0; }
}

/* Tinh chỉnh thanh cuộn */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #a0865d; border-radius: 2px; }

/* =========================================
   THÊM MỚI: CSS CHO MÀN HÌNH CHỜ (PHONG BÌ)
   ========================================= */

/* =========================================
   NÂNG CẤP: CSS CHO MÀN HÌNH CHỜ (LUXURY)
   ========================================= */

/* =========================================
   NÂNG CẤP: HIỆU ỨNG RÚT THƯ (REALISTIC)
   ========================================= */

#intro-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #fbf9f5;
    z-index: 10000;
    transition: opacity 0.8s ease-out; /* Thời gian biến mất của màn intro */
    cursor: pointer;
    overflow: hidden;
}

.glow-bg {
    position: absolute;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(160,134,93,0.15) 0%, rgba(255,255,255,0) 70%);
    animation: pulse-glow 4s infinite alternate;
    z-index: 0;
}

/* Khu vực phong bì */
.envelope-area {
    position: relative;
    width: 320px;
    height: 220px;
    z-index: 1;
    /* Bỏ animation float khi đang mở để tránh giật */
    transition: transform 0.5s; 
}

/* Hiệu ứng rung nhẹ mời gọi */
.envelope-area.floating {
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d; /* Quan trọng cho 3D */
}

/* 1. Mặt lưng (Nằm dưới cùng) */
.envelope-back {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #8d7350;
    border-radius: 0 0 10px 10px;
    z-index: 1;
}

/* 2. Lá thư (Nằm giữa lưng và túi) */
.letter {
    position: absolute;
    bottom: 0;
    left: 5%;
    width: 90%;
    height: 95%;
    background: #fff;
    background-image: url('https://www.transparenttextures.com/patterns/cream-paper.png');
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* QUAN TRỌNG: Z-index thấp hơn pocket để nhìn như đang ở trong */
    z-index: 2; 
    
    transition: transform 1.5s cubic-bezier(0.45, 0, 0.55, 1); /* Chuyển động rút thư chậm rãi */
    transform-origin: center bottom;
}

.letter-content {
    text-align: center;
    padding: 15px;
    border: 1px solid #a0865d;
    width: 90%;
    height: 90%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s;
}

/* 3. Túi phong bì (Che một phần lá thư) */
.pocket {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0; 
    height: 0; 
    border-left: 160px solid #f2e8d9;
    border-right: 160px solid #f2e8d9;
    border-bottom: 110px solid #e6dccf;
    border-top: 110px solid transparent;
    border-radius: 0 0 10px 10px;
    
    /* QUAN TRỌNG: Z-index cao hơn letter */
    z-index: 3; 
    pointer-events: none; /* Để vẫn click xuyên qua được nếu cần */
}

/* 4. Nắp phong bì (Trên cùng khi đóng) */
.flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 0; 
    height: 0; 
    
    /* Hình dáng nắp */
    border-style: solid;
    border-width: 120px 160px 0 160px;
    border-color: #f7f2e8 transparent transparent transparent; /* Màu sáng nhất vì hứng ánh sáng */
    
    transform-origin: top;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), z-index 0.6s;
    z-index: 4; 
    
    /* QUAN TRỌNG: Đổ bóng nắp xuống túi -> Tạo cảm giác tách biệt rõ ràng */
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.15));
}

/* Đường viền mờ cho nắp để rõ nét hơn trên nền sáng */
.flap::after {
    content: '';
    position: absolute;
    top: -120px; /* Bằng border-top width */
    left: -160px;
    width: 320px;
    height: 120px;
    /* Tạo texture giấy nhẹ */
    background-image: url('https://www.transparenttextures.com/patterns/cream-paper.png');
    opacity: 0.5;
    clip-path: polygon(0% 0%, 50% 100%, 100% 0%); /* Cắt theo hình tam giác */
}

/* Con dấu */
.wax-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -20%);
    width: 50px;
    height: 50px;
    background: radial-gradient(circle at 30% 30%, #d4af37, #a0865d, #705b35);
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5c4a28;
    font-size: 20px;
    border: 2px dashed #bfa36f;
    transition: all 0.4s ease;
}

/* --- TRẠNG THÁI MỞ (ANIMATION PHASES) --- */

/* Giai đoạn 1: Mở nắp */
.envelope.open-flap .flap {
    transform: rotateX(180deg);
    z-index: 0; /* Nắp lật ra sau lưng */
}

.envelope.open-flap .wax-seal {
    opacity: 0;
    transform: translate(-50%, -20%) scale(1.5);
}

/* Giai đoạn 2: Rút thư (Pull Out) */
.envelope.pull-out .letter {
    /* Rút lên cao hẳn (vượt qua khỏi phong bì) và phóng to một chút */
    transform: translateY(-300px) scale(1.1); 
    transition-delay: 0.2s; /* Đợi nắp mở xong mới rút */
}
.envelope.pull-down .letter {
    /* Rút lên cao hẳn (vượt qua khỏi phong bì) và phóng to một chút */
    transform: translateY(0) scale(1.1); 
    z-index: 6;
}

/* Giai đoạn 3: Phóng to toàn màn hình (Zoom) */
.envelope.zoom-in {
    transform: scale(3); /* Phóng to cả cụm để tạo hiệu ứng đi vào bên trong */
    opacity: 0; /* Mờ dần */
    transition: transform 1s, opacity 1s;
}

/* Ẩn hint text khi bắt đầu mở */
.intro-fading .hint-text {
    opacity: 0;
    transition: opacity 0.3s;
}
/* --- NÚT ĐỔI NGÔN NGỮ --- */
#lang-switch {
    transition: all 0.3s ease;
}

.lang-option {
    padding: 4px;
    border-radius: 50%;
    opacity: 0.4;
    transition: all 0.3s ease;
    filter: grayscale(80%);
}

/* Trạng thái đang chọn */
.lang-option.active {
    opacity: 1;
    filter: grayscale(0%);
    background-color: rgba(160,134,93,0.1); /* Màu nền nhẹ */
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.lang-option:hover {
    opacity: 0.8;
}

/* --- TOAST NOTIFICATION (THÔNG BÁO COPY) --- */
#toast-notification {
    visibility: hidden; /* Ẩn mặc định */
    min-width: 250px;
    background-color: rgba(60, 60, 60, 0.9); /* Màu nền đen mờ */
    color: #fff; /* Chữ trắng */
    text-align: center;
    border-radius: 50px; /* Bo tròn */
    padding: 16px;
    position: fixed;
    z-index: 10001; /* Phải cao hơn mọi thứ */
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%); /* Canh giữa màn hình */
    font-size: 14px;
    border: 1px solid #a0865d; /* Viền màu vàng gold */
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    
    /* Hiệu ứng hiện ra */
    opacity: 0;
    transition: opacity 0.5s, bottom 0.5s;
    font-family: 'Cormorant Garamond', serif;
    letter-spacing: 1px;
}

/* Class kích hoạt hiện thông báo */
#toast-notification.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px; /* Trượt nhẹ lên trên */
}

/* Icon check trong thông báo */
#toast-notification i {
    color: #a0865d;
    margin-right: 8px;
    font-size: 16px;
}