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

:root {
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --bg-input: #f1f3f4;
    --bg-hover: #e8eaed;
    --border: #e0e0e0;
    --border-dark: #d0d0d0;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-muted: #70757a;
    --accent-blue: #1a73e8;
    --accent-blue-hover: #1765cf;
    --accent-red: #d93025;
    --accent-green: #1e8e3e;
    --accent-orange: #f9ab00;
    --shadow-sm: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --shadow-md: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* 导航栏 */
.nav {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 30px;
}

.nav-logo {
    width: 32px;
    height: 32px;
}

.nav-brand-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.nav-link.active {
    background: #e8f0fe;
    color: var(--accent-blue);
}

/* 容器 */
.container {
    max-width: 1000px;
    margin: 24px auto;
    padding: 0 20px;
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.card-title.download { color: var(--accent-blue); }
.card-title.upload { color: var(--accent-orange); }
.card-title.review { color: var(--accent-green); }

.card-body {
    padding: 0;
}

/* 列表条目 */
.list-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: background 0.2s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: #fafafa;
}

.active-item {
    background: #f8faff;
    border-left: 4px solid var(--accent-blue);
    padding-left: 16px;
}

.active-upload {
    background: #fffbef;
    border-left-color: var(--accent-orange);
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.item-actions {
    display: flex;
    gap: 8px;
}

/* 进度条 */
.progress-wrap {
    margin-top: 8px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 2px;
}

.progress-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-blue);
    min-width: 30px;
    text-align: right;
    font-family: 'SF Mono', Monaco, monospace;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    outline: none;
}

.btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    color: #fff;
}

.btn-danger {
    background: #fff;
    border-color: #f5c2c7;
    color: var(--accent-red);
}

.btn-danger:hover {
    background: #f8d7da;
    color: #842029;
}

.btn-success {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #fff;
}

.btn-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    background: var(--bg-input);
    color: var(--text-secondary);
}

.badge-warning {
    background: #fef7e0;
    color: #b06000;
}

/* 状态标签 */
.status-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-ok { color: var(--accent-green); background: #e6f4ea; }
.status-error { color: var(--accent-red); background: #fce8e6; }

/* 实用工具 */
.empty {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.pulse {
    display: inline-block;
    color: var(--accent-green);
    margin-right: 6px;
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.item-moved-in {
    animation: move-highlight 2s ease-out;
}

@keyframes move-highlight {
    0% { background-color: #e6f4ea; }
    30% { background-color: #e6f4ea; }
    100% { background-color: transparent; }
}

.active-item.item-moved-in {
    animation: active-move-highlight 2s ease-out;
}

@keyframes active-move-highlight {
    0% { background-color: #c4e1cb; }
    30% { background-color: #c4e1cb; }
    100% { background-color: #e8f0fe; }
}

.active-upload.item-moved-in {
    animation: upload-move-highlight 2s ease-out;
}

@keyframes upload-move-highlight {
    0% { background-color: #fce8b2; }
    30% { background-color: #fce8b2; }
    100% { background-color: #fef7e0; }
}

/* 导航栏通知指示灯 */
.nav-notify-simple {
    display: flex;
    align-items: center;
}

.notify-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-dark);
    display: inline-block;
    transition: background 0.3s, box-shadow 0.3s;
}

.notify-dot.connected {
    background: var(--accent-green);
    box-shadow: 0 0 5px var(--accent-green);
}

/* 浮动通知弹窗 */
.ntfy-popup {
    position: fixed;
    top: 68px;
    right: 20px;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(60, 64, 67, 0.18);
    z-index: 300;
    padding: 14px 16px;
    animation: notifySlideIn 0.25s ease-out;
    border-left: 4px solid var(--accent-blue);
    transition: opacity 0.3s, transform 0.3s, top 0.3s;
}

.ntfy-popup.priority-1, .ntfy-popup.priority-2 { border-left-color: var(--text-muted); }
.ntfy-popup.priority-3 { border-left-color: var(--accent-blue); }
.ntfy-popup.priority-4 { border-left-color: var(--accent-orange); }
.ntfy-popup.priority-5 { border-left-color: var(--accent-red); }

.ntfy-popup-icon {
    float: left;
    margin-right: 10px;
    font-size: 20px;
}

.ntfy-popup-content {
    overflow: hidden;
}

.ntfy-popup.hiding {
    opacity: 0;
    transform: translateX(30px);
}

.ntfy-popup-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.ntfy-popup-msg {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.ntfy-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

@keyframes notifySlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.item-cmd {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, 'Consolas', monospace;
    margin-top: 6px;
    cursor: pointer;
    background: var(--bg-input);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.2s;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-cmd:hover {
    color: var(--accent-blue);
    background: var(--bg-hover);
}

.item-cmd.copied {
    color: var(--accent-green);
    background: #e6f4ea;
    font-weight: 600;
}

.index {
    color: var(--text-muted);
    font-weight: 400;
    margin-right: 4px;
    font-family: 'SF Mono', Monaco, monospace;
}

/* 消息提示 (Flash) */
.message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.message-success { background: #e6f4ea; color: #137333; }
.message-error { background: #fce8e6; color: #c5221f; }

/* 各种样式 */
.play-link {
    font-size: 12px;
    color: var(--accent-blue);
    text-decoration: none;
    margin-left: 8px;
}

.play-link:hover { text-decoration: underline; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
}

.stat-item {
    background: var(--bg-body);
    padding: 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label { font-size: 12px; color: var(--text-secondary); }
.stat-value { font-size: 24px; font-weight: 600; color: var(--text-primary); }

.switch-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.switch-info { flex: 1; }
.switch-label { font-size: 14px; font-weight: 500; }
.switch-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Switch Toggle */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.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-dark); transition: .2s; border-radius: 20px;
}
.slider:before {
    position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px;
    background-color: white; transition: .2s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-blue); }
input:checked + .slider:before { transform: translateX(20px); }

.input-group { display: flex; gap: 10px; }
.input-field {
    flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 4px;
    font-size: 14px; outline: none;
}
.input-field:focus { border-color: var(--accent-blue); }

.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-20px);
    padding: 10px 24px; border-radius: 24px; background: #323336; color: #fff;
    font-size: 14px; z-index: 1000; box-shadow: var(--shadow-md);
    opacity: 0; visibility: hidden; transition: all 0.3s;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.toast-success { background: #1e8e3e; }
.toast-error { background: #d93025; }

/* HTMX 加载指示器 */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator {
    opacity: 1;
}
.htmx-request.htmx-indicator {
    opacity: 1;
}
