:root {
    --bg-color: #030712;
    --card-bg: rgba(17, 24, 39, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-error: #ef4444;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --glow-color: rgba(59, 130, 246, 0.15);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Cosmic background glow */
.glow-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo .icon {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 span {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0;
}

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

main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Glassmorphism Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Inputs & Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-with-button {
    display: flex;
    gap: 12px;
}

input[type="url"] {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="url"]:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
}

button {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    padding: 16px 30px;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Settings */
.advanced-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

select {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-main);
    outline: none;
    cursor: pointer;
}

/* Loading status & Console */
.progress-container {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 25px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.status-info h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.status-info p {
    color: var(--text-muted);
}

.console-wrapper {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.console-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.console-header button {
    padding: 4px 10px;
    font-size: 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.console-log {
    height: 250px;
    overflow-y: auto;
    padding: 15px 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-line {
    color: var(--text-muted);
    word-break: break-all;
}

.log-line.system { color: #f59e0b; }
.log-line.ai { color: #a855f7; }
.log-line.downloader { color: #3b82f6; }
.log-line.ffmpeg { color: #ec4899; }
.log-line.error { color: var(--accent-error); font-weight: bold; }

/* Clips grid */
.section-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.clips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.clip-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.clip-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px -5px rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    background: black;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.clip-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.clip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.duration {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.clip-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
}

.reason {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    flex-grow: 1;
}

.btn-download {
    display: block;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    text-decoration: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-download:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: var(--accent-primary);
}

footer {
    text-align: center;
    margin-top: 60px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

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

@media (max-width: 768px) {
    .input-with-button {
        flex-direction: column;
    }
    
    .advanced-settings {
        grid-template-columns: 1fr;
    }
    
    .logo h1 {
        font-size: 2.2rem;
    }
}

/* Cookies Section Styling */
.cookies-section {
    margin-bottom: 10px;
    padding: 20px 30px;
}

.cookies-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.cookies-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.cookies-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.cookies-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.cookies-status-info {
    font-size: 0.95rem;
    font-weight: 600;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-badge.checking {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.cookies-upload-form {
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-upload-wrapper input[type="file"] {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.cookies-actions {
    display: flex;
    gap: 10px;
}

.cookies-actions button {
    padding: 10px 20px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
}

@media (max-width: 768px) {
    .cookies-body {
        flex-direction: column;
        align-items: flex-start;
    }
    .cookies-upload-form {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }
}

/* Navigation Tabs */
.tabs-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 99px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.tab-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Explore styles */
.explore-controls-section {
    padding: 20px 30px;
    margin-bottom: 10px;
}

.explore-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.explore-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.explore-folder-selectors {
    display: flex;
    gap: 15px;
}

.folder-btn {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.folder-btn:hover {
    color: var(--text-main);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.folder-btn.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.1);
}

.gallery-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.gallery-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    backdrop-filter: blur(16px);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
    opacity: 0.5;
}

.gallery-empty p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Card layout adjustments */
.clip-source-info {
    font-size: 0.8rem;
    color: var(--accent-secondary);
    font-weight: 600;
    margin-top: -4px;
}

.card-meta-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-top: 10px;
}

.btn-delete-item {
    display: block;
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--accent-error);
    text-decoration: none;
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    margin-top: 8px;
    cursor: pointer;
}

.btn-delete-item:hover {
    background: var(--accent-error);
    color: white;
    border-color: transparent;
}

@media (max-width: 768px) {
    .explore-folder-selectors {
        flex-direction: column;
    }
}
