/**
 * 文件路径: /home/ubuntu/talktalk_backend/public/css/base.css
 * 功能用途: 全局基础样式，重置及通用类
 * 版本: v3.0
 * 描述: 可爱卡通风格基础设置
 */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-primary);
    /* 移除纯色背景，使用天空渐变 */
    background: linear-gradient(180deg, #4FC3F7 0%, #E0F7FA 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden; /* 防止body滚动，由main-content处理 */
    height: 100vh;
    width: 100vw;
    transition: background 0.5s ease, color 0.5s ease;
    position: relative;
    -webkit-text-size-adjust: 100%; /* 禁止iOS横竖屏切换自动调整字体大小 */
    text-size-adjust: 100%;
}

/* 深色模式天空背景 */
[data-theme="dark"] body {
    background: linear-gradient(180deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
}

/* 背景装饰层 */
.bg-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

/* ================== 天空元素 ================== */

/* 太阳 */
.sun {
    position: absolute;
    top: 50px;
    right: 50px;
    width: 80px;
    height: 80px;
    background: #FFD54F;
    border-radius: 50%;
    box-shadow: 0 0 40px #FFD54F;
    animation: sunSpin 20s linear infinite;
    z-index: 1;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.sun::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    border-radius: 50%;
    border: 4px dashed #FFECB3;
    animation: sunPulse 4s ease-in-out infinite alternate;
}

@keyframes sunSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes sunPulse {
    from { opacity: 0.6; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1.1); }
}

/* 月亮 (默认隐藏，深色显示) */
.moon {
    position: absolute;
    top: 60px;
    right: 60px;
    width: 60px;
    height: 60px;
    background: #FFF9C4;
    border-radius: 50%;
    box-shadow: 0 0 20px #FFF9C4;
    opacity: 0;
    transition: all 0.5s ease;
    transform: translateY(-50px) rotate(-20deg);
}

.moon::after {
    content: '';
    position: absolute;
    top: 10px; left: 10px;
    width: 10px; height: 10px;
    background: rgba(200, 200, 200, 0.2);
    border-radius: 50%;
}

[data-theme="dark"] .moon {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

[data-theme="dark"] .sun {
    opacity: 0;
    transform: translateY(50px);
}

/* 星星容器 (默认隐藏) */
.stars {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 80%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

[data-theme="dark"] .stars {
    opacity: 1;
}

/* 单个星星 */
.star {
    position: absolute;
    background: #FFF;
    border-radius: 50%;
    box-shadow: 0 0 4px #FFF;
    opacity: 0; /* 初始透明，由动画控制 */
    animation: twinkle var(--duration, 3s) infinite ease-in-out;
}

.star-1 { top: 10%; left: 10%; width: 3px; height: 3px; --duration: 3s; animation-delay: 0s; }
.star-2 { top: 20%; left: 80%; width: 4px; height: 4px; --duration: 4s; animation-delay: 1s; }
.star-3 { top: 40%; left: 20%; width: 2px; height: 2px; --duration: 2.5s; animation-delay: 2s; }
.star-4 { top: 15%; left: 40%; width: 3px; height: 3px; --duration: 3.5s; animation-delay: 0.5s; }
.star-5 { top: 30%; left: 60%; width: 2px; height: 2px; --duration: 4.5s; animation-delay: 1.5s; }
.star-6 { top: 50%; left: 90%; width: 3px; height: 3px; --duration: 3s; animation-delay: 2.5s; }
.star-7 { top: 5%; left: 70%; width: 2px; height: 2px; --duration: 5s; animation-delay: 1s; }
.star-8 { top: 25%; left: 30%; width: 4px; height: 4px; --duration: 3.8s; animation-delay: 0.2s; }

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); box-shadow: 0 0 8px #FFF; }
}

/* 流星容器 */
.shooting-stars {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
}

[data-theme="dark"] .shooting-stars {
    opacity: 1;
}

/* 单个流星 */
.shooting-star {
    position: absolute;
    height: 2px;
    background: linear-gradient(-45deg, rgba(255,255,255,1), rgba(255,255,255,0));
    border-radius: 999px;
    filter: drop-shadow(0 0 6px rgba(255,255,255,1));
    animation: shoot 6s linear infinite;
    opacity: 0;
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px #FFF;
}

/* 流星参数调整 */
.shooting-star-1 {
    top: 0; right: 20%;
    width: 100px;
    transform: rotate(-45deg) translateX(0);
    animation-delay: 2s;
    animation-duration: 7s;
}

.shooting-star-2 {
    top: 10%; right: 5%;
    width: 150px;
    transform: rotate(-45deg) translateX(0);
    animation-delay: 5s;
    animation-duration: 8s;
}

.shooting-star-3 {
    top: -5%; right: 35%;
    width: 80px;
    transform: rotate(-45deg) translateX(0);
    animation-delay: 8s;
    animation-duration: 6s;
}

@keyframes shoot {
    0% {
        transform: rotate(-45deg) translateX(0);
        opacity: 1;
    }
    10% {
        opacity: 1;
    }
    20% {
        transform: rotate(-45deg) translateX(-800px);
        opacity: 0;
    }
    100% {
        transform: rotate(-45deg) translateX(-800px);
        opacity: 0;
    }
}

/* 云朵 */
.cloud {
    position: absolute;
    background: #FFFFFF;
    border-radius: 50px;
    opacity: 0.7;
    z-index: 2;
    transition: background-color 0.5s ease, opacity 0.5s ease;
}

.cloud::after, .cloud::before {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
}

.cloud-1 { 
    top: 15%; left: -10%; width: 100px; height: 40px; 
    animation: floatCloud 35s linear infinite;
}
.cloud-1::after { width: 40px; height: 40px; top: -20px; left: 15px; }
.cloud-1::before { width: 30px; height: 30px; top: -15px; left: 50px; }

.cloud-2 { 
    top: 25%; left: -20%; width: 140px; height: 60px; 
    animation: floatCloud 45s linear infinite; 
    animation-delay: 5s; 
}
.cloud-2::after { width: 60px; height: 60px; top: -30px; left: 25px; }
.cloud-2::before { width: 45px; height: 45px; top: -20px; left: 80px; }

.cloud-3 { 
    top: 8%; left: -15%; width: 80px; height: 35px; 
    animation: floatCloud 55s linear infinite; 
    animation-delay: 20s; 
    opacity: 0.5;
}
.cloud-3::after { width: 35px; height: 35px; top: -18px; left: 10px; }

@keyframes floatCloud {
    0% { transform: translateX(0); }
    100% { transform: translateX(120vw); }
}

[data-theme="dark"] .cloud {
    opacity: 0.1;
    background: #78909C;
}

/* ================== 地面元素 ================== */

.ground-elements {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 200px;
    z-index: 1;
}

.grass-hill {
    position: absolute;
    bottom: -50px;
    width: 120%;
    height: 150px;
    border-radius: 50% 50% 0 0;
    transition: background-color 0.5s ease;
}

.grass-1 {
    left: -10%;
    background: #81C784; /* Light Green */
    z-index: 1;
}

.grass-2 {
    right: -10%;
    height: 180px;
    background: #66BB6A; /* Slightly Darker Green */
    z-index: 0;
}

[data-theme="dark"] .grass-1 { background: #2E7D32; }
[data-theme="dark"] .grass-2 { background: #1B5E20; }

/* ================== 动物 ================== */

.animals-container {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 250px; /* 增加容器高度以容纳更大的动物 */
    z-index: 2;
    pointer-events: none;
}

/* 动物包装器 */
.animal-wrapper {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.animal-content {
    width: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    position: relative;
    z-index: 2;
    transform-origin: bottom center;
}

/* 阴影元素 */
.animal-shadow {
    width: 60%;
    height: 12px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    margin-top: -8px;
    z-index: 1;
    transform-origin: center center;
}

/* --- 位置与大小定义 (错落分布 - 2025-12-01 调整：打散且放大) --- */

/* Panda - 左侧近景 */
.wrapper-panda {
    left: 2%;
    bottom: 10px;
    z-index: 10;
}
.wrapper-panda .animal-content { height: 150px; }

/* Rabbit - 左侧远景 */
.wrapper-rabbit {
    left: 10%;
    bottom: 60px;
    z-index: 5;
}
.wrapper-rabbit .animal-content { height: 110px; }

/* Monkey - 左中近景 */
.wrapper-monkey {
    left: 20%;
    bottom: 20px;
    z-index: 9;
}
.wrapper-monkey .animal-content { height: 140px; }

/* Cat - 左中远景 */
.wrapper-cat {
    left: 30%;
    bottom: 70px;
    z-index: 4;
}
.wrapper-cat .animal-content { height: 130px; }

/* Dog - 左中偏右远景 */
.wrapper-dog {
    left: 40%;
    bottom: 40px;
    z-index: 5;
}
.wrapper-dog .animal-content { height: 140px; }

/* Cow - 右中偏左近景 */
.wrapper-cow {
    right: 40%;
    bottom: 25px;
    z-index: 8;
}
.wrapper-cow .animal-content { height: 160px; }

/* Horse - 右中远景 */
.wrapper-horse {
    right: 30%;
    bottom: 45px;
    z-index: 6;
}
.wrapper-horse .animal-content { height: 160px; }

/* Giraffe - 右侧远景 */
.wrapper-giraffe {
    right: 10%;
    bottom: 50px;
    z-index: 6;
}
.wrapper-giraffe .animal-content { height: 240px; }

/* Sloth - 右侧地面 */
.wrapper-sloth {
    right: 5%;
    bottom: 15px;
    z-index: 3;
}
.wrapper-sloth .animal-content { height: 100px; }

/* Raccoon - 右侧近景 */
.wrapper-raccoon {
    right: 20%;
    bottom: 10px;
    z-index: 10;
}
.wrapper-raccoon .animal-content { height: 120px; }



/* --- 动画定义 --- */

/* 弹跳 (Bounce) - 熊猫, 狮子, 老虎 */
.anim-bounce {
    animation: animBounce 2s infinite cubic-bezier(0.28, 0.84, 0.42, 1);
}
.shadow-bounce {
    animation: shadowBounce 2s infinite cubic-bezier(0.28, 0.84, 0.42, 1);
}

@keyframes animBounce {
    0%, 100% { transform: translateY(0) scale(1, 1); }
    45% { transform: translateY(-20px) scale(1, 1); }
    50% { transform: translateY(-20px) scale(1, 1); }
    60% { transform: translateY(0) scale(1.05, 0.95); } /* 落地挤压 */
}
@keyframes shadowBounce {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    45%, 50% { transform: scale(0.7); opacity: 0.2; }
    60% { transform: scale(1.1); opacity: 0.6; }
}

/* 跳跃 (Hop) - 兔子, 狗, 浣熊 */
.anim-hop {
    animation: animHop 1s infinite cubic-bezier(0.28, 0.84, 0.42, 1);
}
.shadow-hop {
    animation: shadowHop 1s infinite cubic-bezier(0.28, 0.84, 0.42, 1);
}

@keyframes animHop {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}
@keyframes shadowHop {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(0.6); opacity: 0.2; }
}

/* 悬浮 (Float) - 猫咪 */
.anim-float {
    animation: animFloat 3s infinite ease-in-out;
}
.shadow-float {
    animation: shadowFloat 3s infinite ease-in-out;
}

@keyframes animFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}
@keyframes shadowFloat {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(0.8); opacity: 0.3; }
}

/* 摇摆 (Sway) - 长颈鹿 */
.anim-sway {
    animation: animSway 4s infinite ease-in-out;
}
@keyframes animSway {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

/* 慢摇摆 (Sway Slow) - 树懒 */
.anim-sway-slow {
    animation: animSway 6s infinite ease-in-out;
}

/* 摇晃 (Swing) - 猴子 */
.anim-swing {
    animation: animSwing 3s infinite ease-in-out;
}
@keyframes animSwing {
    0%, 100% { transform: rotate(0deg) translateY(0); }
    25% { transform: rotate(5deg) translateY(-5px); }
    75% { transform: rotate(-5deg) translateY(-5px); }
}

/* 静态阴影微动 */
.shadow-static {
    animation: shadowPulse 3s infinite ease-in-out;
}
@keyframes shadowPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 0.4; }
}

/* 卡通滚动条 */
::-webkit-scrollbar {
    width: var(--scrollbar-width);
    height: var(--scrollbar-width);
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 10px;
    margin: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
    border: 2px solid var(--scrollbar-track);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 字体工具类 */
.cartoon-font {
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* 通用隐藏 */
.hidden { display: none !important; }

/* 卡通加载动画 */
.cartoon-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: none; /* 默认隐藏 */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.cartoon-spinner {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

[data-theme="dark"] .cartoon-loading {
    background-color: rgba(38, 50, 56, 0.9);
}
