/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    color: #2d3436;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #2d3436;
    font-size: 2.5em;
    margin-bottom: 5px;
}

.subtitle {
    color: #636e72;
    font-size: 1.1em;
}

/* 卡片通用样式 */
section {
    margin-bottom: 20px;
    border-radius: 10px;
    background: #f8f9fa;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: #dfe6e9;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #b2bec3;
}

.card-header h2 {
    margin: 0;
    font-size: 1.3em;
}

.card-content {
    padding: 20px;
}

/* 控制面板样式 */
.control-panel {
    border-left: 4px solid #6c5ce7;
}

.control-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    /* 居中所有内容 */
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    justify-content: center;
    /* 居中输入和按钮 */
}

.control-item label {
    font-weight: bold;
    min-width: 150px;
    color: #6c5ce7;
    text-align: center;
}

/* 只针对自动更新间隔标签，字体黑色且左对齐 */
label[for="update-interval"] {
    color: #222;
}

.control-item input {
    padding: 8px;
    border: 1px solid #b2bec3;
    border-radius: 4px;
    width: 80px;
    text-align: center;
}

.control-buttons {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    justify-content: center;
    /* 居中按钮 */
}

.status-display {
    display: flex;
    flex-direction: column;
    /* 分行展示 */
    align-items: center;
    /* 居中内容 */
    gap: 8px;
    font-size: 0.9em;
    margin-top: 10px;
}

/* 预警卡片样式 */
.alerts-card {
    border-left: 4px solid #e17055;
    background: #ffeaa7 !important;
}

.badge {
    background: #e17055;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

/* 天气卡片样式 */
.weather-card {
    border-left: 4px solid #74b9ff;
}

/* 建议卡片样式 */
.advice-card {
    border-left: 4px solid #00b894;
}

/* 更新类型徽章样式 */
.update-badge {
    background: #00b894;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
}

.update-badge.forced {
    background: #e17055;
}

.update-badge.auto {
    background: #00b894;
}

/* 按钮样式 */
button {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #00b894;
    color: white;
}

.btn-primary:hover {
    background: #00a382;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c5ce7;
    color: white;
}

.btn-secondary:hover {
    background: #5c4fd7;
    transform: translateY(-2px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.action-buttons button {
    flex: 1;
    padding: 15px;
}

/* 历史记录样式 */
.history-card {
    border-left: 4px solid #a29bfe;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 3px solid #74b9ff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-time {
    font-size: 0.9em;
    color: #636e72;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-content {
    white-space: pre-line;
    line-height: 1.5;
}

.history-content pre {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin-top: 5px;
    overflow-x: auto;
}

/* 状态指示器 */
.status-on {
    color: #00b894;
    font-weight: bold;
}

.status-off {
    color: #e17055;
    font-weight: bold;
}

.status-updating {
    color: #fdcb6e;
    font-weight: bold;
}

/* 元数据样式 */
.metadata {
    font-size: 0.9em;
    color: #636e72;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #dfe6e9;
}

/* 页脚样式 */
.location-info {
    text-align: center;
    font-size: 0.9em;
    color: #636e72;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #dfe6e9;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }

    .control-item {
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .control-item label {
        min-width: auto;
        text-align: center;
    }

    .control-buttons {
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .action-buttons {
        flex-direction: column;
    }

    .card-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* 按钮悬停效果优化 */
button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 卡片悬停效果 */
section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s ease;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #b2bec3;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #636e72;
}

/* Markdown内容美化（建议区域） */
#advice-info h1,
#advice-info h2,
#advice-info h3,
#advice-info h4,
#advice-info h5,
#advice-info h6 {
    margin: 1em 0 0.5em 0;
    font-weight: bold;
    color: #0984e3;
}

#advice-info ul,
#advice-info ol {
    margin: 1em 0 1em 2em;
    padding-left: 1.2em;
}

#advice-info li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

#advice-info p {
    margin: 0.8em 0;
    line-height: 1.7;
}

#advice-info strong {
    color: #d35400;
    font-weight: bold;
}

#advice-info em {
    color: #636e72;
    font-style: italic;
}

#advice-info code,
#advice-info pre {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 0.95em;
}

#advice-info pre {
    padding: 10px;
    margin: 1em 0;
    overflow-x: auto;
}

/* 预警卡片出现/消失动画 */
@keyframes alertFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes alertFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.alert-fade-in {
    animation: alertFadeIn 0.8s;
}

.alert-fade-out {
    animation: alertFadeOut 0.8s;
}