/**
 * 波&雪的专属纪念网页 - 浪漫主题样式
 * 专为情侣纪念网页设计的浪漫视觉风格
 */

/* ========== CSS变量定义 ========== */
:root {
    --primary-color: #ff6b9d;
    --secondary-color: #a8e6cf;
    --accent-color: #ffd93d;
    --love-pink: #ffb3d9;
    --love-purple: #c89ae6;
    --text-color: #2c2c54;
    --text-light: #ffffff;
    --background-overlay: rgba(255, 107, 157, 0.1);
    --glass-background: rgba(255, 255, 255, 0.08);
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.1);
    --border-radius: 20px;
    --transition: all 0.3s ease;
}

/* ========== 基础重置和字体 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg,
        #ff9a9e 0%,
        #fecfef 50%,
        #fecfef 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ========== 背景图片轮播容器 ========== */
.background-slider {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

/* 模糊填充背景层 */
.background-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(20px) brightness(0.6);
    z-index: 1;
}

/* 清晰图片层 */
.background-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: inherit;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(1.0);
    z-index: 2;
}

.background-image.active {
    opacity: 1;
}

/* 图片加载动画 */
.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    color: white;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-loading p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

/* 背景遮罩 */
.background-slider::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 107, 157, 0.02); /* 进一步减少遮罩，让图片更清晰 */
    z-index: 1;
}

/* ========== 主容器 ========== */
.container {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* ========== 头部区域 ========== */
.love-header {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.05); /* 更加透明的背景 */
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    margin: 20px 20px 0;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.love-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--love-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

.love-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--text-color);
    opacity: 0.8;
    font-weight: 300;
    letter-spacing: 2px;
}

@keyframes titleGlow {
    0% {
        filter: drop-shadow(0 0 5px rgba(255, 107, 157, 0.3));
    }
    100% {
        filter: drop-shadow(0 0 20px rgba(255, 107, 157, 0.6));
    }
}

/* ========== 主内容区域 ========== */
.love-main {
    flex: 1;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

/* ========== 时间计数器区域 ========== */
.love-timer-section {
    width: 100%;
    max-width: 600px;
}

.timer-container {
    background: rgba(255, 255, 255, 0.06); /* 更加透明的背景 */
    border-radius: var(--border-radius);
    padding: 40px 30px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.timer-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.timer-title {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    color: var(--text-color);
    margin-bottom: 30px;
    font-weight: 600;
}

.timer-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.time-unit {
    background: linear-gradient(135deg, var(--primary-color), var(--love-purple));
    border-radius: 15px;
    padding: 20px 15px;
    color: var(--text-light);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.3);
    transition: var(--transition);
}

.time-unit:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(255, 107, 157, 0.4);
}

.time-number {
    display: block;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.time-label {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    opacity: 0.9;
    font-weight: 300;
}

.timer-date {
    color: var(--text-color);
    opacity: 0.7;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-style: italic;
}

.pulse-animation {
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* ========== 音乐播放器区域 ========== */
.music-section {
    width: 100%;
    max-width: 500px;
}

.music-player {
    background: rgba(255, 255, 255, 0.06); /* 更加透明的背景 */
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.music-btn {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: var(--text-color);
    border: none;
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(168, 230, 207, 0.3);
}

.music-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(168, 230, 207, 0.4);
}

.music-btn.playing {
    background: linear-gradient(135deg, var(--primary-color), var(--love-pink));
    color: var(--text-light);
}

.music-icon {
    font-size: 1.2em;
}

.music-info {
    text-align: center;
    color: var(--text-color);
}

.music-name {
    font-weight: 500;
    opacity: 0.9;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 250px;
}

.volume-icon {
    font-size: 1.3em;
}

.volume-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(255, 107, 157, 0.3);
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

/* ========== 图片控制区域 ========== */
.image-control-section {
    display: none; /* 隐藏整个图片控制区域 */
}

/* 保留样式定义以防需要恢复 */
.image-controls {
    background: var(--glass-background);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.img-btn {
    background: linear-gradient(135deg, var(--love-purple), var(--primary-color));
    color: var(--text-light);
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(200, 154, 230, 0.3);
}

.img-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(200, 154, 230, 0.4);
}

.image-info {
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.auto-play-control {
    background: var(--glass-background);
    border-radius: var(--border-radius);
    padding: 20px 25px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

/* 自定义开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: var(--transition);
    border-radius: 15px;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
    background: linear-gradient(135deg, var(--primary-color), var(--love-purple));
}

.switch input:checked + .slider:before {
    transform: translateX(30px);
}

.switch-label {
    color: var(--text-color);
    font-weight: 500;
    font-size: 1rem;
}

/* ========== 底部区域 ========== */
.love-footer {
    text-align: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.05); /* 更加透明的背景 */
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin: 0 20px 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.love-message {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--text-color);
    font-weight: 500;
    letter-spacing: 1px;
    animation: messageGlow 4s ease-in-out infinite alternate;
}

@keyframes messageGlow {
    0% {
        text-shadow: 0 0 5px rgba(255, 107, 157, 0.3);
    }
    100% {
        text-shadow: 0 0 15px rgba(255, 107, 157, 0.6);
    }
}

/* ========== 爱心动画背景 ========== */
.hearts-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-heart {
    position: absolute;
    animation: floatUp 6s ease-out forwards;
    pointer-events: none;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(180deg);
        opacity: 0;
    }
}

.click-heart {
    animation: heartPop 0.8s ease-out forwards;
}

@keyframes heartPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

/* ========== 消息弹窗样式 ========== */
.floating-message {
    animation: messageFloat 0.5s ease-out;
}

@keyframes messageFloat {
    0% {
        transform: translateX(-50%) translateY(20px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
}

.special-message-modal .modal-content {
    background: var(--glass-background);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-soft);
    color: var(--text-color);
}

.special-message-modal button {
    background: linear-gradient(135deg, var(--primary-color), var(--love-purple));
    color: var(--text-light);
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: var(--transition);
}

.special-message-modal button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 157, 0.4);
}

/* ========== 无图片/音乐提示 ========== */
.no-images-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: var(--glass-background);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    color: var(--text-color);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 90%;
    width: 400px;
}

.no-images-message h3 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.no-images-message p {
    margin-bottom: 10px;
    opacity: 0.8;
}

.no-images-message code {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.placeholder-heart {
    font-size: 3rem;
    margin-top: 20px;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ========== 过渡动画 ========== */
.image-transition {
    animation: imageTransition 0.5s ease;
}

@keyframes imageTransition {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

.container {
    animation: containerFadeIn 1s ease-out;
}

@keyframes containerFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 图片自适应优化 ========== */
/* 针对横屏显示优化 */
@media (orientation: landscape) and (max-height: 600px) {
    .background-image::after {
        background-size: cover;
        background-position: center;
    }
}

/* 针对竖屏显示优化 */
@media (orientation: portrait) {
    .background-image::after {
        background-size: contain;
        background-position: center;
    }
}

/* 针对超宽屏优化 */
@media (min-aspect-ratio: 16/9) {
    .background-image::after {
        background-size: cover;
        background-position: center;
    }
}

/* 针对正方形或接近正方形的屏幕 */
@media (aspect-ratio: 1/1) or (min-aspect-ratio: 4/5) and (max-aspect-ratio: 5/4) {
    .background-image::after {
        background-size: contain;
        background-position: center;
    }
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .love-header {
        margin: 10px;
        padding: 30px 20px;
    }

    .love-main {
        padding: 20px 10px;
        gap: 25px;
    }

    .timer-container {
        padding: 30px 20px;
    }

    .timer-display {
        gap: 15px;
        grid-template-columns: repeat(2, 1fr);
    }

    .music-player {
        padding: 20px;
    }

    .image-controls {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
    }

    .img-btn {
        width: 100%;
        max-width: 200px;
    }

    .volume-control {
        max-width: 200px;
    }

    .love-footer {
        margin: 0 10px 10px;
        padding: 25px 20px;
    }
}

@media (max-width: 480px) {
    .timer-display {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .time-unit {
        padding: 15px 10px;
    }

    .music-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    .floating-message {
        max-width: 90%;
        font-size: 16px;
        padding: 15px 20px;
    }
}

/* ========== 音乐自动播放提示动画 ========== */
@keyframes slideInRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* ========== 动画优化 ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== 深色模式适配 ========== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #f1f1f1;
        --glass-background: rgba(0, 0, 0, 0.2);
    }

    .timer-date,
    .music-name,
    .switch-label {
        color: var(--text-color);
    }
}