:root {
    --bg-dark: rgb(23, 31, 59);
    --card-bg: rgb(28, 36, 64);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-color: #4a90e2;
    --border-color: rgba(255, 255, 255, 0.1);
    --safe-area-top: env(safe-area-inset-top, 0px);
    --primary-color: #409EFF;
    --success-color: #67C23A;
    --warning-color: #E6A23C;
    --danger-color: #F56C6C;
    --info-color: #606266;
    --text-color: #222;
    --theme-color: rgb(23, 31, 59);
    --header-bg-color: rgb(23, 31, 59);
}

[data-theme="dark"] {
    --primary-color: #409EFF;
    --success-color: #67C23A;
    --warning-color: #E6A23C;
    --danger-color: #F56C6C;
    --info-color: #a0a4aa;
    --card-bg: #23272e;
    --text-color: #f2f2f2;
    --border-color: #31343a;
    --theme-color: rgb(23, 31, 59);
    --header-bg-color: rgb(23, 31, 59);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: var(--bg-dark);
}

body {
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--card-bg) 100%);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    padding-top: var(--safe-area-top);
}

.page {
    min-height: 100vh;
    width: 100%;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* 欢迎页样式 */
.welcome-page {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(23, 31, 59, 0.95), rgba(28, 36, 64, 0.95));
    min-height: 100vh;
}

.welcome-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
    padding: 0 20px;
}

.welcome-content {
    padding: 40px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.welcome-icon {
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 64px;
}

.welcome-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    font-weight: 300;
    color: var(--text-primary);
}

.welcome-search {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    padding: 0 20px;
}

.search-input {
    width: 100%;
    height: 56px;
    padding: 0 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    text-align: center;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-button {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 12px;
    background: var(--accent-color);
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 详情页样式 */
.detail-page {
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--card-bg) 100%);
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: block;
    padding-top: var(--safe-area-top);
}

.detail-page.active {
    opacity: 1;
}

.header-container {
    position: sticky;
    top: calc(var(--safe-area-top));
    z-index: 100;
    background: linear-gradient(180deg, var(--bg-dark) 0%, transparent 100%);
    backdrop-filter: blur(10px);
    margin: -20px -20px 20px -20px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
}

.back-button {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.back-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    max-width: 300px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
}

.search-button {
    padding: 10px 20px;
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: opacity 0.2s;
}

.search-button:hover {
    opacity: 0.9;
}

.weather-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.main-weather {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
}

.current-temp {
    font-size: 4rem;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--text-primary);
}

.weather-desc {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.weather-desc span {
    color: var(--text-primary);
}

.weather-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
}

.location-info {
    text-align: right;
}

.location-info h2 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.datetime {
    color: var(--text-secondary);
}

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

.grid-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.grid-item h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.grid-item > div {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    background: var(--accent-color);
    width: var(--progress, 0%);
    transition: width 0.3s ease;
}

.chart-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 40px;
    height: 300px;
    backdrop-filter: blur(5px);
}

.living-indices {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.living-indices h3 {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.indices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.index-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 15px;
    backdrop-filter: blur(5px);
}

.index-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.index-value {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.index-tips {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.error-message {
    text-align: center;
    color: #ff4757;
    padding: 20px;
}

.d-none {
    display: none !important;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .weather-container {
        padding: 20px;
        margin: 0;
        border-radius: 15px;
    }

    .main-weather {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .current-temp {
        font-size: 3.5rem;
        flex-direction: column;
        gap: 10px;
    }

    .location-info {
        text-align: center;
        width: 100%;
    }

    .location-info h2 {
        font-size: 1.8rem;
    }

    .weather-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .grid-item {
        padding: 15px;
    }

    .grid-item h3 {
        font-size: 0.8rem;
    }

    .grid-item > div {
        font-size: 1.2rem;
    }

    .chart-container {
        height: 250px;
        padding: 15px;
        margin-bottom: 20px;
    }

    .indices-grid {
        grid-template-columns: 1fr;
    }

    .index-item {
        padding: 12px;
    }

    .welcome-container {
        padding: 0 10px;
    }

    .welcome-content {
        padding: 30px 20px;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .welcome-search {
        padding: 0 10px;
    }

    .search-input, 
    .search-button {
        height: 48px;
        font-size: 1rem;
    }

    .header-container {
        padding: 15px 0;
    }

    .header-title {
        font-size: 1.3rem;
    }

    /* 优化触摸区域 */
    .back-button {
        padding: 12px;
    }

    .back-button iconify-icon {
        width: 28px;
        height: 28px;
    }
}

/* 小屏幕手机适配 */
@media screen and (max-width: 360px) {
    .weather-grid {
        grid-template-columns: 1fr;
    }

    .current-temp {
        font-size: 3rem;
    }

    .location-info h2 {
        font-size: 1.5rem;
    }

    .welcome-title {
        font-size: 1.8rem;
    }
}

/* 处理横屏模式 */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .welcome-page {
        padding: 10px;
    }

    .welcome-content {
        padding: 20px;
    }

    .welcome-icon {
        font-size: 48px;
        margin-bottom: 10px;
    }

    .welcome-title {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .weather-container {
        max-height: 90vh;
        overflow-y: auto;
    }

    .main-weather {
        margin-bottom: 20px;
    }

    .chart-container {
        height: 200px;
    }
}

/* 优化暗色模式 */
@media (prefers-color-scheme: dark) {
    .weather-container,
    .grid-item,
    .index-item {
        background: rgba(255, 255, 255, 0.05);
    }

    .search-input {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* 优化高分辨率屏幕 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* 添加滚动条样式 */
.weather-container::-webkit-scrollbar {
    width: 8px;
}

.weather-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.weather-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.weather-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
} 