/* 主样式文件 */

/* 基础样式 */
body {
    background-color: #E3F2FD;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

#container {
    max-width: 480px;
    margin: 0 auto;
    padding-top: env(safe-area-inset-top, 20px);
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* 模态框样式 */

/* 标签页样式 */
.child-tab {
    transition: box-shadow 0.3s ease;
}

.child-tab.active {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 习惯项样式 */
.habit-item {
    transition: all 0.2s ease;
}

.habit-item:active {
    transform: scale(0.98);
}

/* 图表条样式 */
.chart-bar {
    transition: height 0.5s ease;
}

/* 淡入动画 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 徽章获得动画效果 */
@keyframes badgeGlow {
    0% { 
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
        transform: scale(1.1);
    }
    100% { 
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
        transform: scale(1);
    }
}

@keyframes badgePop {
    0% { 
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% { 
        transform: scale(1.3) rotate(180deg);
        opacity: 1;
    }
    100% { 
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

@keyframes sparkle {
    0% { 
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    100% { 
        transform: scale(1.5) rotate(180deg);
        opacity: 0;
    }
}

@keyframes rainbowBackground {
    0% { background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4); }
    25% { background: linear-gradient(45deg, #4ecdc4, #45b7d1, #96ceb4, #ff6b6b); }
    50% { background: linear-gradient(45deg, #45b7d1, #96ceb4, #ff6b6b, #4ecdc4); }
    75% { background: linear-gradient(45deg, #96ceb4, #ff6b6b, #4ecdc4, #45b7d1); }
    100% { background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4); }
}

@keyframes particleFloat {
    0% { 
        transform: translateY(0) translateX(0) scale(1);
        opacity: 1;
    }
    100% { 
        transform: translateY(-100px) translateX(var(--x-offset)) scale(0);
        opacity: 0;
    }
}

.badge-new {
    animation: badgePop 0.6s ease-out, badgeGlow 2s ease-in-out infinite;
}

.badge-glow-effect {
    position: relative;
    overflow: visible;
}

.sparkle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #ffd700, #ffed4e);
    border-radius: 50%;
    animation: sparkle 1s ease-out forwards;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    border-radius: 50%;
    animation: particleFloat 1.5s ease-out forwards;
    pointer-events: none;
}

.achievement-celebration {
    animation: rainbowBackground 3s ease-in-out;
}

.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* 通知动画 */

/* 安装提示动画 */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) translateX(-50%); }
    40% { transform: translateY(-10px) translateX(-50%); }
    60% { transform: translateY(-5px) translateX(-50%); }
}

/* 设置界面样式 */
.settings-item {
    transition: all 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.settings-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.edit-input {
    transition: all 0.2s ease;
    border: 2px solid transparent;
    max-width: 100%;
    box-sizing: border-box;
}

.edit-input:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.emoji-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
}

.emoji-option {
    font-size: 50px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin: 4px;
}

.emoji-option:hover {
    background-color: #F3F4F6;
    transform: scale(1.2);
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 90vw;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-sizing: border-box;
}

/* 通用提示样式 */
.install-prompt-container,
.notification-container,
.update-banner {
    position: fixed;
    color: white;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.install-prompt-container {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #10B981;
    padding: 12px 24px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    cursor: pointer;
    animation: bounce 2s infinite;
}

.install-prompt-close {
    background: transparent;
    border: none;
    color: white;
    margin-left: 12px;
    cursor: pointer;
    font-size: 18px;
}

.notification-container {
    top: 20px;
    right: 20px;
    background: var(--notification-bg, #3B82F6);
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    max-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.update-banner {
    top: 0;
    left: 0;
    right: 0;
    background: #3B82F6;
    padding: 12px;
    text-align: center;
    font-size: 14px;
}

.update-banner-button {
    background: white;
    color: #3B82F6;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    margin-left: 8px;
    cursor: pointer;
}