/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS 变量定义 */
:root {
    --primary-color: #ff0000;
    --primary-hover: #e60000;
    --secondary-color: #606060;
    --success-color: #00d084;
    --warning-color: #ff9500;
    --danger-color: #ff4757;
    --bg-primary: #0f0f0f;
    --bg-secondary: #181818;
    --bg-tertiary: #212121;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #717171;
    --border-color: #303030;
    --shadow-light: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.25);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* 基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 顶部标题栏 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: 20px 30px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary-color), #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    transition: var(--transition);
}

.status-dot.online {
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

.status-dot.offline {
    background: var(--text-muted);
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 通用区块样式 */
section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

/* 输入区域 */
.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.input-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.input-tips .tip {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.textarea-container {
    position: relative;
    margin-bottom: 20px;
}

#url-input {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    resize: vertical;
    transition: var(--transition);
}

#url-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

#url-input::placeholder {
    color: var(--text-muted);
}

.input-counter {
    position: absolute;
    bottom: -25px;
    right: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 画质选择区域 */
.quality-selection {
    margin-bottom: 25px;
}

.quality-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 20px;
}

.quality-selection h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: 0;
    flex-shrink: 0;
}

.quality-select-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.quality-select {
    width: 100%;
    padding: 12px 40px 12px 15px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.quality-select:hover {
    border-color: var(--primary-color);
    background: var(--border-color);
}

.quality-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

.quality-select option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px;
    font-size: 0.9rem;
}

.select-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    transition: var(--transition);
}

.quality-select:focus + .select-icon {
    color: var(--primary-color);
    transform: translateY(-50%) rotate(180deg);
}

.quality-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 15px;
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.quality-note i {
    color: var(--warning-color);
    margin-top: 2px;
    flex-shrink: 0;
}

/* 按钮样式 */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.btn:hover:before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), #ff6b6b);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.3);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn.active {
    background: var(--primary-color);
    color: white;
}

/* 进度区域 */
.progress-section {
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.progress-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

#progress-text {
    color: var(--text-muted);
    font-family: monospace;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #ff6b6b);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#progress-percentage {
    font-family: monospace;
    font-weight: bold;
    min-width: 45px;
    text-align: right;
}

.progress-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 日志区域 */
.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.log-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.log-controls {
    display: flex;
    gap: 8px;
}

.log-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    height: 300px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.log-welcome {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-style: italic;
}

.log-entry {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    animation: logAppear 0.3s ease;
    border-left: 3px solid transparent;
}

@keyframes logAppear {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-entry.info {
    background: rgba(0, 208, 132, 0.1);
    border-left-color: var(--success-color);
    color: #90ee90;
}

.log-entry.warning {
    background: rgba(255, 149, 0, 0.1);
    border-left-color: var(--warning-color);
    color: #ffb366;
}

.log-entry.error {
    background: rgba(255, 71, 87, 0.1);
    border-left-color: var(--danger-color);
    color: #ff8a95;
}

.log-entry.success {
    background: rgba(0, 208, 132, 0.1);
    border-left-color: var(--success-color);
    color: #90ee90;
}

/* 文件列表样式 */
.files-section {
    animation: slideIn 0.5s ease;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.files-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.file-item:hover {
    background: var(--border-color);
    transform: translateX(5px);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-all;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Cookies上传区域样式 */
.cookies-section .cookies-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cookies-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.cookies-status .status-text {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.cookies-status .status-text.success {
    background: rgba(0, 208, 132, 0.2);
    color: var(--success-color);
}

.cookies-status .status-text.warning {
    background: rgba(255, 149, 0, 0.2);
    color: var(--warning-color);
}

.cookies-status .status-text.error {
    background: rgba(255, 71, 87, 0.2);
    color: var(--danger-color);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    transition: var(--transition);
    margin-bottom: 20px;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(255, 0, 0, 0.05);
}

.upload-icon i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.upload-text {
    color: var(--text-secondary);
    line-height: 1.6;
}

.btn-upload {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.btn-upload:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.cookies-help {
    margin-top: 20px;
}

.cookies-help details {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.cookies-help summary {
    padding: 15px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.cookies-help summary:hover {
    background: var(--border-color);
}

.help-content {
    padding: 20px;
}

.help-step h4,
.help-warning h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.help-step ol,
.help-warning ul {
    margin-left: 20px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-step ol li,
.help-warning ul li {
    margin-bottom: 5px;
}

.help-step a {
    color: var(--primary-color);
    text-decoration: none;
}

.help-step a:hover {
    text-decoration: underline;
}

.help-warning {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.3);
    border-radius: 8px;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 25px;
}

.upload-progress {
    text-align: center;
}

.upload-progress .progress-bar {
    margin-bottom: 15px;
}

/* 底部信息 */
.footer {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.footer-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-info code {
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    color: var(--text-primary);
}

.footer-links {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.footer-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    section {
        padding: 20px;
    }
    
    .input-header,
    .progress-header,
    .log-header,
    .files-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .quality-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .quality-select-container {
        max-width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
    
    .footer-info {
        flex-direction: column;
        text-align: center;
    }
    
    .log-container {
        height: 250px;
    }
    
    .progress-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-header,
    .modal-body {
        padding: 15px;
    }
}

/* 加载动画 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 禁用状态 */
.disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none;
}