/* yt-dlp Web UI - 样式文件 */

/* 基础重置和变量 */
:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2ecc71;
    --secondary-dark: #27ae60;
    --danger-color: #e74c3c;
    --danger-dark: #c0392b;
    --warning-color: #f39c12;
    --light-gray: #f8f9fa;
    --medium-gray: #e8e9ea;
    --dark-gray: #7f8c8d;
    --text-color: #333;
    --border-color: #ddd;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --success-color: #2ecc71;
    --info-color: #3498db;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f5f5;
    padding: 20px;
    font-size: 14px;
}

/* 容器布局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-light);
    padding: 30px;
    animation: fadeIn 0.5s ease;
}

/* 标题 */
h1, h2, h3, h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-weight: 600;
}

h1 {
    font-size: 28px;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 12px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h1::before {
    content: "🎬";
}

h2 {
    font-size: 20px;
    margin-top: 10px;
    color: #34495e;
}

h3 {
    font-size: 18px;
    color: #2c3e50;
}

/* 分区样式 */
.section {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--light-gray);
    border-radius: 8px;
    border-left: 5px solid var(--primary-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.section:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px var(--shadow-light);
}

/* 表单元素 */
.input-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

input[type="text"],
input[type="url"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: white;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* 按钮样式 */
button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px var(--shadow-light);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    background: var(--dark-gray);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-primary {
    background: var(--secondary-color);
}

.btn-primary:hover:not(:disabled) {
    background: var(--secondary-dark);
}

.btn-danger {
    background: var(--danger-color);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
}

.btn-warning {
    background: var(--warning-color);
}

/* URL输入区域 */
.url-input {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.url-input input {
    flex: 1;
    min-width: 300px;
}

/* 模式选择器 */
.mode-selector {
    display: flex;
    gap: 25px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.mode-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
    flex: 1;
    min-width: 250px;
}

.mode-option:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}

.mode-option input[type="radio"] {
    margin-top: 3px;
}

.mode-option label {
    margin-bottom: 0;
    cursor: pointer;
}

.mode-option label small {
    display: block;
    margin-top: 5px;
    color: var(--dark-gray);
    font-weight: normal;
}

/* 信息框 */
.info-box {
    background: #e8f4fc;
    border: 2px solid #b3e0ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    display: none;
    animation: slideIn 0.3s ease;
}

.info-box.show {
    display: block;
}

/* 格式标签页 */
.format-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
    gap: 5px;
}

.tab {
    padding: 14px 24px;
    cursor: pointer;
    border: 2px solid transparent;
    border-bottom: none;
    background: var(--light-gray);
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    color: var(--dark-gray);
    transition: color 0.3s, background-color 0.3s, border-color 0.3s;
    position: relative;
    bottom: -2px;
}

.tab:hover {
    color: var(--primary-color);
    background: white;
}

.tab.active {
    background: white;
    border-color: var(--border-color);
    border-bottom-color: white;
    color: var(--primary-color);
    z-index: 1;
}

/* 格式表格 */
.format-table {
    width: 100%;
    border-collapse: collapse;
    display: none;
    animation: fadeIn 0.5s ease;
}

.format-table.active {
    display: table;
}

.format-table th,
.format-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.format-table th {
    background: var(--light-gray);
    font-weight: 700;
    color: #555;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.format-table tr {
    transition: background-color 0.2s;
}

.format-table tr:hover {
    background: #f5f9ff;
}

.format-table td {
    font-size: 14px;
}

/* 格式类型标签 */
.format-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.format-type-badge.type-video {
    background: #e3f2fd;
    color: #1976d2;
}

.format-type-badge.type-audio {
    background: #f3e5f5;
    color: #7b1fa2;
}

.format-type-badge.type-combined {
    background: #e8f5e9;
    color: #388e3c;
}

.format-type-badge.type-subtitle {
    background: #fff3e0;
    color: #f57c00;
}

/* 单选/复选框样式 */
input[type="radio"],
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 选项行布局 */
.option-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.option-group {
    flex: 1;
    min-width: 250px;
}

/* 进度容器 */
.progress-container {
    margin-top: 30px;
    padding: 25px;
    background: var(--light-gray);
    border-radius: 8px;
    border-left: 5px solid var(--info-color);
    display: none;
    animation: slideIn 0.3s ease;
}

.progress-container.show {
    display: block;
}

.progress-bar {
    height: 24px;
    background: var(--medium-gray);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
    box-shadow: inset 0 1px 3px var(--shadow-light);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 50px 50px;
    animation: moveStripes 2s linear infinite;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

/* 状态消息 */
.status-message {
    background: #e8f6ef;
    border: 2px solid #c3e6cb;
    border-radius: 8px;
    padding: 20px;
    margin-top: 25px;
    display: none;
    animation: slideIn 0.3s ease;
}

.status-message.show {
    display: block;
}

/* 下载链接（当前页面未使用，但保留供后续使用） */
.download-link {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    margin-top: 10px;
    display: none;
}

.download-link.show {
    display: inline-block;
}

/* 打开文件夹按钮 */
#openFolderBtn {
    display: none;
    margin-top: 15px;
}

#openFolderBtn.show {
    display: inline-block;
}

/* 错误消息 */
.error-message {
    background: #ffeaea;
    border: 2px solid #ffcccc;
    color: var(--danger-color);
    padding: 18px;
    border-radius: 8px;
    margin-top: 20px;
    display: none;
    font-weight: 600;
    animation: shake 0.5s ease, fadeIn 0.3s ease;
}

.error-message.show {
    display: block;
}

/* 加载指示器 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--dark-gray);
    display: none;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1.2s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    font-size: 16px;
    margin-top: 15px;
}

/* 空状态 */
.empty-message {
    text-align: center;
    padding: 40px;
    color: var(--dark-gray);
    font-style: italic;
}

/* 辅助类 */
.small {
    font-size: 12px;
    color: var(--dark-gray);
}

.code {
    font-family: 'Courier New', monospace;
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-info {
    background: var(--info-color);
    color: white;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-10px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes moveStripes {
    0% { background-position: 0 0; }
    100% { background-position: 50px 50px; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: var(--primary-color);
    }
    
    .progress-fill::after {
        animation: none;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
    }
    
    .section {
        padding: 20px;
    }
    
    .url-input {
        flex-direction: column;
    }
    
    .url-input input {
        min-width: 100%;
    }
    
    .mode-selector {
        flex-direction: column;
    }
    
    .mode-option {
        min-width: 100%;
    }
    
    .option-row {
        flex-direction: column;
    }
    
    .option-group {
        min-width: 100%;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    .format-tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .format-table {
        display: block;
        overflow-x: auto;
    }
    
    button {
        padding: 12px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 20px;
    }
    
    .container {
        padding: 15px;
    }
    
    .section {
        padding: 15px;
    }
}
