/* weather.css  */

:root {
    /* 默认白色模式变量 */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --accent: #4a5568;
    --error-bg: #fff5f5;
    --error-text: #c53030;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 支持系统暗色模式 */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-gradient: linear-gradient(135deg, #434190 0%, #1a365d 100%);
        --card-bg: rgba(26, 32, 44, 0.95);
        --text-primary: #cbd5e0;
        --text-secondary: #a0aec0;
        --accent: #718096;
        --error-bg: #2d2d2d;
        --error-text: #fc8181;
    }
}

/* 支持主题暗色模式切换 - 只定义暗色模式的类，亮色模式使用默认样式 */
body.dark-theme {
    --primary-gradient: linear-gradient(135deg, #434190 0%, #1a365d 100%);
    --card-bg: rgba(26, 32, 44, 0.95);
    --text-primary: #cbd5e0;
    --text-secondary: #a0aec0;
    --accent: #718096;
    --error-bg: #2d2d2d;
    --error-text: #fc8181;
}


.weather-card {
    position: relative;
    width: 100%;
    /* 胶囊形状 - 极大增加圆角 */
    border-radius: 25px;
    backdrop-filter: blur(12px);
    overflow: hidden;
    transform-style: preserve-3d;
    transition: var(--transition);
    /* 添加柔和阴影增强胶囊感 */
    /* box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 8px 12px rgba(0, 0, 0, 0.08); */
    /* 使整体更扁平 */
    max-height: 320px;
    top: 20px;
}

.weather-card:hover {
    transform: translateY(-5px) rotateX(1deg) rotateY(-1deg);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15), 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* 加载状态 */
.loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border-radius: 50px;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--text-secondary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loader-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* 正常内容 */
.weather-content {
    padding: 0.5rem 0.5rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-primary);
}

.last-updated {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.cache-status {
    font-size: 0.7rem;
    color: #48bb78;
    padding: 0.2rem 0.5rem;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.main-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weather-art {
    position: relative;
    width: 80px;
    height: 80px;
    left: 25px;
}

#weatherIcon {
    position: absolute;
    width: 80px;
    height: 80px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    color: var(--text-primary);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.temperature-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.temperature {
    font-size: 2.8rem;
    font-weight: 300;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.unit {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.weather-meta {
    display: grid;
    /* 调整布局以容纳分隔符 */
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    background: rgba(160, 174, 192, 0.1);
    padding: 0.7rem;
    border-radius: 20px;
    margin-top: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.meta-item i {
    font-size: 1.1rem;
    color: var(--accent);
}

.value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.label {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* 更美观的分隔符样式 */
.meta-divider {
    width: 1px;
    background: rgba(113, 128, 150, 0.3);
    height: 40px;
    align-self: center;
}

/* 移除divider，因为在平衡布局中不再需要它 */
.divider {
    display: none;
}

/* 错误状态 */
.error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--error-bg);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3;
    border-radius: 50px;
}

.error-content {
    text-align: center;
    padding: 2rem;
}

.error-message {
    color: var(--error-text);
    margin: 1rem 0;
    font-weight: 500;
}

.retry-btn {
    background: none;
    border: 2px solid var(--error-text);
    color: var(--error-text);
    padding: 0.5rem 1rem;
    /* 增加圆角匹配胶囊风格 */
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.retry-btn:hover {
    background: var(--error-text);
    color: white;
}

#welcomeMsg {
    position: relative;
    bottom: -7px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 天气粒子效果 */
#weatherCanvas {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}