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

/* Top Navigation Bar */
.top-nav {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s;
}

.nav-logo a:hover {
    opacity: 0.8;
}

.nav-lang select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    transition: border-color 0.3s;
}

.nav-lang select:hover {
    border-color: var(--accent-color);
}

.nav-lang select:focus {
    outline: none;
    border-color: var(--accent-color);
}

:root {
    --primary-color: #ff0000;
    --secondary-color: #282828;
    --accent-color: #065fd4;
    --bg-color: #f9f9f9;
    --card-bg: #ffffff;
    --text-color: #030303;
    --text-secondary: #606060;
    --border-color: #e5e5e5;
    --success-color: #2ba640;
    --error-color: #cc0000;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Header */
header {
    text-align: center;
    padding: 40px 0;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Sections */
section {
    background: var(--card-bg);
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-color);
}

section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

/* Input Section */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.url-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.3s;
}

.url-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.help-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background-color: #cc0000;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

.btn-secondary:hover {
    background-color: #181818;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

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

/* Video Info */
.info-card {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.thumbnail {
    width: 320px;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.info-details {
    flex: 1;
}

.info-details h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.info-details p {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.info-details strong {
    color: var(--text-color);
}

/* Platform theming */
.theme-youtube {
    --primary-color: #ff0000;
    --accent-color: #ff4d4d;
    --secondary-color: #282828;
}

.theme-bilibili {
    --primary-color: #fb7299; /* Bilibili pink */
    --accent-color: #00a1d6;  /* Bilibili blue */
    --secondary-color: #2c2c2c;
}

/* Homepage tool card visuals */
.tool-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: block;
}

.card-banner {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--bg-color);
}

.card-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tool-card.youtube {
    border-left: 4px solid #ff0000;
}

.tool-card.youtube .tool-title {
    color: #ff0000;
}

.tool-card.bilibili {
    border-left: 4px solid #fb7299;
}

.tool-card.bilibili .tool-title {
    color: #fb7299;
}

/* Tool page banners */
.platform-banner {
    width: 100%;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin: 12px 0 0;
}

.platform-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video description specific styling */
.description-container {
    position: relative;
}

.description-text {
    display: block;
    padding: 10px;
    background-color: var(--bg-color);
    border-radius: 6px;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 0.9rem;
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.description-text.collapsed {
    max-height: 100px;
    position: relative;
}

.description-text.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--bg-color));
}

.description-text.expanded {
    max-height: none;
}

.description-toggle {
    margin-top: 8px;
    padding: 6px 16px;
    font-size: 0.875rem;
    color: var(--accent-color);
    background: none;
    border: 1px solid var(--accent-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.description-toggle:hover {
    background-color: var(--accent-color);
    color: white;
}

.description-toggle.hidden {
    display: none;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    font-size: 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    font-weight: 600;
}

.tab-btn:hover {
    color: var(--text-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Option Groups */
.option-group {
    margin-bottom: 20px;
}

.option-label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
}

.select-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
}

.select-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.select-input[multiple] {
    height: 150px;
}

/* Radio and Checkbox Groups */
.radio-group,
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Horizontal option lists used for available/unavailable sections */
.option-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px; /* space between section title and options */
}

/* Ensure option root containers stack titles and lists vertically */
#audioOptions,
#videoSilentOptions,
#videoWithAudioOptions {
    display: block;
}

/* Spacing for titles inside option containers */
#audioOptions > p.help-text,
#videoSilentOptions > p.help-text,
#videoWithAudioOptions > p.help-text {
    margin-bottom: 6px;
}

.radio-label,
.checkbox-label {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background-color: white;
    user-select: none;
}

.radio-label:hover,
.checkbox-label:hover {
    border-color: var(--accent-color);
    background-color: rgba(6, 95, 212, 0.05);
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
}

.radio-label input[type="radio"]:checked ~ span,
.checkbox-label input[type="checkbox"]:checked ~ span {
    font-weight: 600;
}

.radio-label:has(input:checked),
.checkbox-label:has(input:checked) {
    border-color: var(--accent-color);
    background-color: rgba(6, 95, 212, 0.1);
    box-shadow: 0 2px 6px rgba(6, 95, 212, 0.2);
}

.radio-label span,
.checkbox-label span {
    color: var(--text-color);
    font-size: 0.95rem;
}

/* Disabled option appearance */
.radio-label.option-disabled,
.checkbox-label.option-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: #e0e0e0;
    background-color:rgb(172, 172, 172);
    filter: grayscale(100%);
}

.radio-label.option-disabled:hover,
.checkbox-label.option-disabled:hover {
    border-color: #e0e0e0;
    background-color: #f3f3f3;
}

.radio-label.option-disabled input[type="radio"],
.checkbox-label.option-disabled input[type="checkbox"] {
    cursor: not-allowed;
}

/* Two Column Layout for Video With Audio */
.two-column-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.two-column-layout .column {
    flex: 1;
}

.column-title {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-color);
    font-weight: 600;
}

/* Progress */
.progress-bar {
    width: 100%;
    height: 30px;
    background-color: var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    width: 0%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
}

/* Result Section */
.result-content {
    padding: 20px;
    background-color: var(--bg-color);
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
}

.result-content.error {
    border-left-color: var(--error-color);
}

.result-content h4 {
    margin-bottom: 10px;
    color: var(--success-color);
}

.result-content.error h4 {
    color: var(--error-color);
}

.result-content p {
    margin-bottom: 8px;
}

.download-link {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.3s;
}

.download-link:hover {
    background-color: #0552b5;
}

/* Footer */
footer {
    font-size:0.8rem;
    text-align: center;
    padding: 20px 0;
    color: var(--text-secondary);
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Loading Animation */
.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 1rem;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* File Size Styling */
.file-size {
    color: var(--accent-color);
    font-weight: 600;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .input-group {
        flex-direction: column;
    }

    .info-card {
        flex-direction: column;
    }

    .thumbnail {
        width: 100%;
    }

    .tabs {
        overflow-x: auto;
    }

    .two-column-layout {
        flex-direction: column;
        gap: 0;
    }
}
