@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f3f4f6;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

/* 隐藏滚动条 */
.no-scrollbar::-webkit-scrollbar { 
    display: none; 
}

.no-scrollbar { 
    -ms-overflow-style: none; 
    scrollbar-width: none; 
}

/* 加载指示器样式 */
#loading-indicator {
    transition: opacity 0.5s ease;
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.98) 100%);
}

#loading-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 加载动画增强 */
#loading-indicator .animate-bounce {
    animation: bounce 1.4s infinite;
}

#loading-indicator .animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* 页面切换优化 */
.page {
    position: absolute; 
    inset: 0; 
    background-color: #f3f4f6;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    opacity: 0; 
    pointer-events: none; 
    z-index: 0;
    transform: translateX(20px); 
    display: none; 
    padding-bottom: 80px;
}

.page.active {
    opacity: 1; 
    pointer-events: auto; 
    z-index: 10;
    transform: translateX(0); 
    display: flex; 
    flex-direction: column;
}

.page.fullscreen {
    padding-bottom: 0; 
    z-index: 100; 
    background: white;
}

.page.sub-page { 
    z-index: 50; 
    padding-bottom: 0; 
}

/* 页面切换时的平滑过渡 */
.page-transition-enter {
    opacity: 0;
    transform: translateX(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.3s ease;
}

.page-transition-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

/* 视觉元素 */
.ruler-texture {
    background-image: linear-gradient(to bottom, transparent 50%, rgba(255,255,255,0.3) 50%);
    background-size: 100% 8px;
}

.liquid-bar { 
    transition: width 1.5s cubic-bezier(0.34, 1.56, 0.64, 1); 
}

.modal-overlay { 
    transition: opacity 0.3s ease; 
}

.modal-content { 
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
}

.nav-fab-wrapper { 
    position: absolute; 
    left: 50%; 
    top: -24px; 
    transform: translateX(-50%); 
    z-index: 40; 
}

/* 动画 */
@keyframes breathe {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(0.98); 
        opacity: 0.9; 
    }
}

.timer-breathe { 
    animation: breathe 3s infinite ease-in-out; 
}

.toggle-checkbox:checked { 
    right: 0; 
    border-color: #0d9488; 
}

.toggle-checkbox:checked + .toggle-label { 
    background-color: #0d9488; 
}

.icon-option.selected { 
    background-color: #0d9488; 
    color: white; 
    border-color: #0d9488; 
}

.color-option.selected { 
    ring: 2px; 
    ring-offset: 2px; 
    ring-color: #0d9488; 
}

/* 统计页面样式 */
.stats-card {
    background: linear-gradient(135deg, var(--gradient-from), var(--gradient-to));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.achievement-badge {
    transition: transform 0.2s ease;
}

.achievement-badge:hover {
    transform: scale(1.05);
}

/* 图表容器样式 */
.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

/* 全局loading样式 */
#global-loading {
    transition: opacity 0.3s ease;
    backdrop-filter: blur(8px);
}

#global-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

/* loading旋转动画 */
.border-3 {
    border-width: 3px;
}

/* ApexCharts 容器样式 */
#score-trend-chart,
#task-completion-chart,
#wish-distribution-chart {
    height: 100%;
    width: 100%;
}

/* 统计按钮样式 */
.stats-btn-active {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    color: white;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.stats-btn-inactive {
    background: #f3f4f6;
    color: #6b7280;
}

.stats-btn-inactive:hover {
    background: #e5e7eb;
}

/* 自定义Alert样式 */
.custom-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 9999;
    min-width: 280px;
    max-width: 90vw;
    opacity: 0;
    scale: 0.8;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-alert.show {
    opacity: 1;
    scale: 1;
}

.custom-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-alert-overlay.show {
    opacity: 1;
}

.custom-alert-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
}

.custom-alert-icon.info {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.custom-alert-icon.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.custom-alert-icon.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.custom-alert-icon.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* 首页顶部美化样式 */
.home-header-gradient {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #06b6d4 100%);
    position: relative;
    overflow: hidden;
}

/* 登录页面渐变样式 - 使用高特异性选择器 */
#view-login .login-gradient,
button.login-gradient,
div.login-gradient,
.login-gradient {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #06b6d4 100%) !important;
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.4) !important;
}

.home-header-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.home-stats-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.home-stats-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.balance-display {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 2px;
    backdrop-filter: blur(5px);
}

.progress-bar-inner {
    background: linear-gradient(90deg, #fbbf24, #f59e0b, #d97706);
    border-radius: 10px;
    height: 8px;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
    position: relative;
    overflow: hidden;
}

.progress-bar-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.user-avatar-button {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.user-avatar-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* 强制覆盖Tailwind样式 - 放在文件最后确保优先级 */
.login-gradient {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #06b6d4 100%) !important;
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.4) !important;
}

/* 确保登录按钮样式正确应用 */
#view-login button.login-gradient,
#view-login .login-gradient,
button.login-gradient,
div.login-gradient {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #06b6d4 100%) !important;
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.4) !important;
}

/* 加载指示器也使用相同样式 */
#loading-indicator .login-gradient {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #06b6d4 100%) !important;
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.4) !important;
}