/**
 * TVBox配置生成器页面样式
 * 风格与screen-recorder.css保持一致
 */

/* Vue加载前隐藏未编译的模板 - 使用opacity实现平滑过渡 */
[v-cloak] {
    opacity: 0 !important;
}

/* 页面加载动画 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 与RAID计算器保持一致 - 使用默认背景 */
body {
    background-color: #f5f5f5;
    color: #333;
}

/* 移除tvbox-config-page的背景色 */
.tvbox-config-page {
    background-color: transparent !important;
}

/* Noscript后备样式 */
.noscript-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    margin: 20px;
}

/* ===== 页面容器 - 与RAID计算器一致 ===== */
.tvbox-config-page {
    max-width: 1400px;
    margin: 40px auto 60px;
    padding: 0 20px;
    min-height: calc(100vh - 65px);
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* ===== 页面头部 - 与RAID计算器一致 ===== */
.tvbox-config-page .page-header {
    text-align: center;
    margin-bottom: 40px;
}

.tvbox-config-page .page-header .header-icon {
    width: 56px;
    height: 56px;
    color: #2c3e50;
    margin-bottom: 16px;
}

.tvbox-config-page .page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.tvbox-config-page .page-header p {
    font-size: 16px;
    color: #666;
    margin: 0;
    line-height: 1.6;
}

/* ===== 主容器布局 ===== */
.config-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (min-width: 1024px) {
    .config-container {
        grid-template-columns: 1fr 450px;
    }
}

@media (min-width: 1280px) {
    .config-container {
        grid-template-columns: 1fr 500px;
    }
}

/* ===== 配置面板通用样式 ===== */
.config-section,
.preview-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
    margin-bottom: 24px;
}

.section-header {
    padding: 20px 24px;
    background: #f8f8f8;
    border-bottom: 1px solid #e8e8e8;
}

.section-header h2,
.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
}

.section-header h2 svg,
.section-header h3 svg {
    flex-shrink: 0;
    color: #2c3e50;
}

.section-desc {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.section-body {
    padding: 24px;
}

.section-footer {
    padding: 20px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* ===== 表单样式 ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: #fff;
    color: #2d3748;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #718096;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.form-row.checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4a5568;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2c3e50;
}

/* ===== 配置项卡片 ===== */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.config-item {
    position: relative;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.2s;
}

.config-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e0;
}

.config-item .item-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.config-item:hover .item-actions {
    opacity: 1;
}

/* ===== 按钮样式 ===== */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: #718096;
}

.btn-icon:hover {
    background: #e2e8f0;
    color: #e53e3e;
}

.btn-icon.danger:hover {
    background: #fed7d7;
    color: #c53030;
}

.btn-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    background: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add:hover {
    background: #34495e;
    transform: translateY(-1px);
}

.btn-add:active {
    transform: translateY(0);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: #34495e;
    transform: translateY(-1px);
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    color: #e53e3e;
    border: 1px solid #fed7d7;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #fff5f5;
    border-color: #fc8181;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-download:hover {
    background: #34495e;
    transform: translateY(-1px);
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.9);
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: #fff;
    border-color: #cbd5e0;
}

/* ===== 代码编辑器 ===== */
.code-editor-wrapper {
    position: relative;
}

.code-editor {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

.code-editor:focus {
    outline: none;
    border-color: #2c3e50;
}

.code-actions {
    position: absolute;
    top: 10px;
    right: 10px;
}

.code-error {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(229, 62, 62, 0.95);
    color: #fff;
    border-radius: 6px;
    font-size: 0.85rem;
    backdrop-filter: blur(4px);
}

/* ===== 提示框 ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-top: 12px;
}

.alert.error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
}

.alert.info {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #333;
}

.alert strong {
    font-weight: 600;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
}

.empty-state p {
    margin: 0;
}

/* ===== 输入组合 ===== */
.input-with-btn {
    display: flex;
    gap: 10px;
}

.input-with-btn input {
    flex: 1;
}

.flex-1 {
    flex: 1;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    z-index: 1001;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #f8f8f8;
    border-bottom: 1px solid #e8e8e8;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: 24px;
}

.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== Spinner ===== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== 功能说明区域 ===== */
.info-section {
    margin-top: 40px;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.info-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.info-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin: 30px 0 16px;
}

.info-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

/* ===== 功能网格 ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.feature-card {
    padding: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    color: #2c3e50;
}

.feature-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 10px 0;
}

.feature-card p {
    font-size: 0.95rem;
    color: #718096;
    margin: 0;
    line-height: 1.5;
}

/* ===== 步骤容器 ===== */
.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.step-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #2c3e50;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.step-content p {
    font-size: 0.9rem;
    color: #718096;
    margin: 4px 0 0 0;
}

/* ===== FAQ Section 样式 - 新版 ===== */
.faq-section {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-top: 40px;
    overflow: hidden;
}

.faq-section > .faq-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 30px;
}

.faq-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 12px 0;
}

.faq-title svg {
    color: #2c3e50;
}

.faq-subtitle {
    text-align: center;
    color: #64748b;
    font-size: 1rem;
    margin: 0 0 40px 0;
}

.faq-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .faq-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.faq-grid .faq-item {
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 24px;
    transition: all 0.2s ease;
}

.faq-grid .faq-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}

.faq-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 16px 0;
    line-height: 1.4;
}

.faq-answer {
    color: #475569;
    line-height: 1.8;
}

.faq-answer p {
    margin: 0 0 12px 0;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

.faq-answer ul,
.faq-answer ol {
    margin: 12px 0;
    padding-left: 24px;
}

.faq-answer li {
    margin-bottom: 8px;
}

.faq-answer code {
    background: #e2e8f0;
    color: #2c3e50;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.9em;
}

.faq-answer strong {
    color: #2c3e50;
}

/* ===== FAQ（旧版兼容） ===== */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.faq-item summary {
    padding: 16px 20px;
    font-weight: 600;
    color: #2d3748;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    color: #2c3e50;
    transition: transform 0.2s;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item p {
    padding: 0 20px 16px;
    margin: 0;
    color: #4a5568;
    line-height: 1.6;
}

.faq-item ul {
    padding: 0 20px 16px 40px;
    margin: 0;
    color: #4a5568;
    line-height: 1.8;
}

.faq-item li {
    margin-bottom: 4px;
}

/* ===== 示例代码框 ===== */
.example-box {
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-top: 20px;
}

.example-box h4 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #2d3748;
}

.example-box pre {
    background: #f1f5f9;
    color: #334155;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0;
    border: 1px solid #e2e8f0;
}

.example-box code {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ===== 过渡动画 ===== */
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
    opacity: 0;
    transform: translateY(-10px);
}

/* ===== 响应式调整 ===== */
@media (max-width: 768px) {
    .tvbox-config-page {
        padding: 12px;
    }

    .tvbox-config-page .page-header {
        padding: 30px 16px;
    }

    .tvbox-config-page .page-header h1 {
        font-size: 1.6rem;
    }

    .section-header {
        padding: 16px 20px;
    }

    .section-body {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn-row {
        grid-template-columns: 1fr;
    }

    .info-section {
        padding: 20px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .steps-container {
        grid-template-columns: 1fr;
    }
}
