/**
 * 天气查询应用 - 样式表
 * 设计风格：正式、专业、清晰
 */

/* ============================================
   基础重置
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 隐藏但保留给屏幕阅读器的元素 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   容器
   ============================================ */
.container {
    max-width: 500px;
    width: 100%;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* ============================================
   标题区域
   ============================================ */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 30px 20px;
    text-align: center;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 1px;
}

/* ============================================
   主要内容区域
   ============================================ */
.main-content {
    padding: 30px 25px;
}

/* ============================================
   搜索区域
   ============================================ */
.search-section {
    margin-bottom: 25px;
}

.search-wrapper {
    display: flex;
    gap: 10px;
}

.city-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
}

.city-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.city-input::placeholder {
    color: #999;
}

.search-btn {
    padding: 14px 20px;
    font-size: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.search-btn:active {
    transform: translateY(0);
}

/* ============================================
   天气显示区域
   ============================================ */
.weather-section {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 位置和日期信息 */
.location-info {
    margin-bottom: 20px;
}

.location-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.location-icon {
    margin-right: 5px;
}

.country-separator {
    margin: 0 3px;
}

.date-info {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-icon,
.day-night-icon {
    font-size: 16px;
}

/* 分隔线 */
.divider {
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #e0e0e0 20%, 
        #e0e0e0 80%, 
        transparent 100%);
    margin: 20px 0;
}

/* 当前天气 */
.current-weather {
    text-align: center;
    margin-bottom: 20px;
}

.weather-status {
    margin-bottom: 15px;
}

.weather-icon {
    font-size: 60px;
    display: block;
    margin-bottom: 10px;
}

.weather-desc {
    font-size: 18px;
    color: #555;
    font-weight: 500;
}

/* 当前温度卡片 */
.current-temp-card {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid #667eea30;
    border-radius: 12px;
    padding: 25px;
    margin: 0 auto;
    max-width: 280px;
}

.temp-value {
    font-size: 56px;
    font-weight: 700;
    color: #667eea;
    line-height: 1;
    margin-bottom: 12px;
}

.temp-unit {
    font-size: 32px;
    font-weight: 400;
    color: #764ba2;
    margin-left: 4px;
}

.temp-time {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.time-icon {
    font-size: 16px;
}

.time-label {
    font-weight: 500;
}

/* 今日温度范围 */
.today-temp-range {
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #444;
    margin-bottom: 15px;
}

.temp-range-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    font-size: 15px;
}

.temp-range-item + .temp-range-item {
    border-top: 1px solid #f0f0f0;
}

.range-icon {
    font-size: 20px;
    margin-right: 10px;
}

.range-label {
    font-weight: 500;
    color: #555;
    min-width: 50px;
}

.range-value {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-left: 15px;
}

.range-value .temp-unit {
    font-size: 14px;
    font-weight: 400;
    color: #666;
}

.range-time {
    margin-left: auto;
    font-size: 13px;
    color: #999;
}

.time-desc {
    margin-right: 3px;
}

/* 更新信息 */
.update-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: #999;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.update-icon {
    font-size: 16px;
}

.update-text {
    margin-right: 3px;
}

/* ============================================
   初始提示
   ============================================ */
.initial-prompt {
    text-align: center;
    padding: 40px 20px;
}

.prompt-content {
    animation: fadeIn 0.8s ease-in;
}

.prompt-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.prompt-text {
    font-size: 18px;
    color: #555;
    margin-bottom: 10px;
    font-weight: 500;
}

.prompt-hint {
    font-size: 14px;
    color: #999;
}

/* ============================================
   消息提示
   ============================================ */
.message-section {
    margin-top: 20px;
}

.message-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    position: relative;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-box.error {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.message-box.warning {
    background-color: #fff8e1;
    border: 1px solid #ffe082;
    color: #f57c00;
}

.message-box.success {
    background-color: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

.message-box.info {
    background-color: #e3f2fd;
    border: 1px solid #90caf9;
    color: #1565c0;
}

.message-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.message-text {
    flex: 1;
    line-height: 1.5;
}

.message-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: inherit;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.message-close:hover {
    opacity: 1;
}

/* ============================================
   加载动画
   ============================================ */
.loading-section {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: #666;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 12px;
    }

    .header {
        padding: 25px 15px;
    }

    .header h1 {
        font-size: 20px;
    }

    .main-content {
        padding: 25px 20px;
    }

    .city-input {
        padding: 12px 15px;
        font-size: 15px;
    }

    .search-btn {
        padding: 12px 18px;
        font-size: 18px;
    }

    .weather-icon {
        font-size: 50px;
    }

    .temp-value {
        font-size: 48px;
    }

    .temp-unit {
        font-size: 28px;
    }

    .current-temp-card {
        padding: 20px;
    }

    .location-name {
        font-size: 16px;
    }

    .date-info {
        font-size: 13px;
    }

    .prompt-icon {
        font-size: 60px;
    }

    .prompt-text {
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    .temp-value {
        font-size: 42px;
    }

    .temp-unit {
        font-size: 24px;
    }

    .range-value {
        font-size: 16px;
    }

    .search-wrapper {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
    }
}

/* ============================================
   打印样式
   ============================================ */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
        max-width: 100%;
    }

    .search-section,
    .message-section,
    .loading-section {
        display: none !important;
    }

    .header {
        background: #667eea;
        color: white;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

