/* ========== 根据时间的主题颜色方案 ========== */
:root {
    /* 默认深色主题（晚上 18:00 - 6:00） */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --bg-input: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --success-color: #22c55e;
    --warning-color: #eab308;
    --error-color: #ef4444;
    --progress-bg: #21262d;
    --progress-fill: #2563eb;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* 早晨主题 (6:00 - 12:00) - 温暖的橙色调 */
[data-theme="morning"] {
    --bg-primary: #1a1410;
    --bg-secondary: #231c15;
    --bg-card: #2a221a;
    --bg-input: #33291f;
    --text-primary: #f5e6d3;
    --text-secondary: #c9a889;
    --text-muted: #8b7355;
    --border-color: #4a3d2e;
    --accent-color: #f97316;
    --accent-hover: #ea580c;
    --success-color: #22c55e;
    --warning-color: #eab308;
    --error-color: #ef4444;
    --progress-bg: #33291f;
    --progress-fill: #f97316;
}

/* 下午主题 (12:00 - 18:00) - 清爽的蓝绿色调 */
[data-theme="afternoon"] {
    --bg-primary: #0f1419;
    --bg-secondary: #151c24;
    --bg-card: #1a242f;
    --bg-input: #1f2937;
    --text-primary: #e0f2fe;
    --text-secondary: #7dd3fc;
    --text-muted: #38bdf8;
    --border-color: #0ea5e9;
    --accent-color: #06b6d4;
    --accent-hover: #0891b2;
    --success-color: #22c55e;
    --warning-color: #eab308;
    --error-color: #ef4444;
    --progress-bg: #1f2937;
    --progress-fill: #06b6d4;
}

/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ========== Header 样式 ========== */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    margin-bottom: 16px;
}

.logo-img {
    width: 64px;
    height: 64px;
    background: #fff;
    border-radius: 12px;
    padding: 8px;
}

.title {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ========== 搜索框样式 ========== */
.search-box {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.search-input {
    width: 280px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.search-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background-color: var(--accent-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn:hover {
    background-color: var(--accent-hover);
}

.search-btn:active {
    transform: scale(0.98);
}

.search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spinner {
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========== 结果卡片样式 ========== */
.results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.course-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.course-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.card-info {
    flex: 1;
}

.course-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.course-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.progress-section {
    width: 200px;
    text-align: right;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.progress-bar {
    height: 8px;
    background-color: var(--progress-bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--progress-fill);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.sync-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-row {
    font-size: 13px;
}

.status-label {
    color: var(--text-secondary);
}

.status-value {
    font-weight: 500;
}

.status-value.completed {
    color: var(--success-color);
}

.status-value.processing {
    color: var(--warning-color);
}

.status-value.error {
    color: var(--error-color);
}

.order-time {
    font-size: 12px;
    color: var(--text-muted);
}

.card-actions {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline {
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-primary {
    color: #fff;
    background-color: var(--accent-color);
    border: none;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

/* ========== 空状态样式 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ========== Toast 通知样式 ========== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background-color: var(--success-color);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.error {
    background-color: var(--error-color);
}

.toast-icon {
    font-size: 16px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== 弹窗样式 ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.detail-value {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-align: right;
    max-width: 60%;
}

/* ========== 工具类 ========== */
.hidden {
    display: none !important;
}

/* ========== 响应式设计 ========== */
@media (max-width: 640px) {
    .container {
        padding: 20px 16px;
    }

    .search-box {
        flex-direction: column;
        align-items: center;
    }

    .search-input {
        width: 100%;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .card-header {
        flex-direction: column;
        gap: 16px;
    }

    .progress-section {
        width: 100%;
        text-align: left;
    }

    .card-footer {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .card-actions {
        width: 100%;
    }

    .card-actions .btn {
        flex: 1;
        justify-content: center;
    }
}
