/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 根变量 - 支持深色/浅色模式 */
:root {
    /* 浅色模式 */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --accent-color: #4285f4;
    --accent-hover: #3367d6;
    --warning-color: #fbbc05;
    --danger-color: #ea4335;
    --success-color: #34a853;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --countdown-normal: #4285f4;
    --countdown-yellow: #fbbc05;
    --countdown-red: #ea4335;
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #121212;
        --bg-secondary: #1e1e1e;
        --text-primary: #ffffff;
        --text-secondary: #b0b0b0;
        --border-color: #333333;
        --accent-color: #8ab4f8;
        --accent-hover: #5f99f7;
        --warning-color: #ffd666;
        --danger-color: #ff6b6b;
        --success-color: #81c784;
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --countdown-normal: #8ab4f8;
        --countdown-yellow: #ffd666;
        --countdown-red: #ff6b6b;
    }
}

/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* 头部样式 */
header {
    background-color: var(--bg-secondary);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

nav {
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

nav a:hover, nav a.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* 主内容区 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 倒计时区域 */
#countdown-section {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.countdown-normal {
    border-left: 4px solid var(--countdown-normal);
}

.countdown-yellow {
    border-left: 4px solid var(--countdown-yellow);
    animation: pulse-yellow 2s infinite;
}

.countdown-red {
    border-left: 4px solid var(--countdown-red);
    animation: pulse-red 1s infinite;
}

@keyframes pulse-yellow {
    0%, 100% { box-shadow: var(--shadow); }
    50% { box-shadow: 0 0 20px rgba(251, 188, 5, 0.3); }
}

@keyframes pulse-red {
    0%, 100% { box-shadow: var(--shadow); }
    50% { box-shadow: 0 0 20px rgba(234, 67, 53, 0.4); }
}

#countdown-title {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

#countdown-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

.time-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.time-number {
    font-size: 3rem;
    color: var(--accent-color);
    font-weight: 800;
    line-height: 1;
}

.time-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.time-separator {
    color: var(--accent-color);
    font-size: 3rem;
    font-weight: 300;
    line-height: 0.8;
}

/* 今日操作模式 */
#today-mode {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.today-alert {
    width: 100%;
}

.today-alert h2 {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 2rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

#today-countdown h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

#today-countdown-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

/* 最后30分钟高亮闪烁 */
.today-countdown-warning {
    animation: blink 1s infinite;
    color: var(--danger-color) !important;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

/* 节假日列表 */
#holidays-section {
    margin-bottom: 2rem;
}

#holidays-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.filter-sort {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

/* 节假日网格 */
.holidays-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* 节假日卡片 */
.holiday-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-left: 4px solid var(--accent-color);
}

.holiday-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.holiday-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.holiday-dates {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.critical-date {
    background-color: var(--accent-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 1rem;
    display: inline-block;
}

.holiday-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* 展开/收起按钮 */
.toggle-description {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
}

.toggle-description:hover {
    color: var(--accent-hover);
    transform: translateX(2px);
}

/* 设置页面样式 */
.settings-container {
    max-width: 800px;
    margin: 0 auto;
}

.settings-section {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.settings-section h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* 节假日管理列表 */
.holiday-management {
    margin-top: 1rem;
}

.holiday-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}

.holiday-item-info {
    flex: 1;
}

.holiday-item-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.holiday-item-dates {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.holiday-item-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-danger {
    background-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #d93025;
    box-shadow: 0 4px 12px rgba(234, 67, 53, 0.3);
}

.btn-success {
    background-color: var(--success-color);
}

.btn-success:hover {
    background-color: #2e7d32;
    box-shadow: 0 4px 12px rgba(52, 168, 83, 0.3);
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    nav {
        gap: 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    #countdown-display,
    #today-countdown-display {
        font-size: 1.5rem;
        gap: 0.25rem;
    }
    
    .time-number {
        font-size: 2rem;
    }
    
    .time-separator {
        font-size: 2rem;
    }
    
    .time-unit {
        min-width: 45px;
    }
    
    .holidays-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .holiday-card {
        padding: 1rem;
    }
    
    #today-mode {
        padding: 1.5rem 1rem;
    }
    
    .today-alert h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    #countdown-display,
    #today-countdown-display {
        font-size: 1.2rem;
    }
    
    .time-number {
        font-size: 1.5rem;
    }
    
    .time-separator {
        font-size: 1.5rem;
    }
    
    .time-unit {
        min-width: 35px;
    }
    
    .time-label {
        font-size: 0.7rem;
    }
}