/* ========================================
   YT Music Downloader - Modern Dark Theme
   ======================================== */

/* CSS Variables */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-card: #1e1e1e;
    --bg-hover: #2a2a2a;

    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #6b6b6b;

    --accent-red: #ff0033;
    --accent-red-hover: #cc0029;
    --accent-green: #1db954;
    --accent-green-hover: #1ed760;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-yellow: #f59e0b;
    --accent-purple: #8b5cf6;

    --border-color: #333333;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 0, 51, 0.3);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-red-hover));
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px rgba(255, 0, 51, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-red-hover), #aa0022);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(255, 0, 51, 0.3);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--accent-green-hover);
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* ========================================
   Login Page
   ======================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a0a0a 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .logo-icon {
    font-size: 3.5rem;
    color: var(--accent-red);
    margin-bottom: 16px;
    filter: drop-shadow(0 0 20px rgba(255, 0, 51, 0.4));
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(90deg, var(--text-primary), var(--accent-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group label i {
    color: var(--accent-red);
    width: 16px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-normal);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(255, 0, 51, 0.15);
}

.btn-login {
    margin-top: 8px;
    padding: 16px;
    font-size: 1rem;
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

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

.login-footer i {
    color: var(--accent-red);
}

/* ========================================
   Header
   ======================================== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo i {
    font-size: 1.75rem;
    color: var(--accent-red);
}

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-info i {
    color: var(--accent-purple);
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
    min-height: calc(100vh - 140px);
}

/* Sections */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 600;
}

.section-header h2 i {
    color: var(--accent-red);
}

/* ========================================
   Download Section
   ======================================== */
.download-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.download-form {
    margin-bottom: 0;
}

.input-group {
    display: flex;
    gap: 12px;
    align-items: stretch;
    position: relative;
}

.input-group .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-red);
    font-size: 1.25rem;
    z-index: 1;
}

.input-group input {
    flex: 1;
    padding: 16px 16px 16px 52px;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-normal);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(255, 0, 51, 0.15);
}

/* Progress Section */
.progress-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.progress-info i {
    color: var(--accent-blue);
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-red), var(--accent-purple));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    width: 0%;
}

/* ========================================
   Downloads Section
   ======================================== */
.downloads-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

/* States */
.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.loading-state i,
.empty-state i {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Downloads List */
.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.download-item:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    transform: translateX(4px);
}

.download-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-red), var(--accent-purple));
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.download-info {
    flex: 1;
    min-width: 0;
}

.download-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.download-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.download-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-meta i {
    font-size: 0.7rem;
}

.download-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 20px 24px;
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer i {
    color: var(--accent-red);
}

.footer .separator {
    color: var(--border-color);
}

/* ========================================
   Notification Toast
   ======================================== */
.notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transform: translateY(100px);
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: 1000;
    max-width: calc(100vw - 48px);
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.success {
    border-color: var(--accent-green);
}

.notification.success .notification-icon {
    color: var(--accent-green);
}

.notification.error {
    border-color: var(--accent-red);
}

.notification.error .notification-icon {
    color: var(--accent-red);
}

.notification.warning {
    border-color: var(--accent-yellow);
}

.notification.warning .notification-icon {
    color: var(--accent-yellow);
}

.notification.info {
    border-color: var(--accent-blue);
}

.notification.info .notification-icon {
    color: var(--accent-blue);
}

.notification-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.notification-message {
    color: var(--text-primary);
    font-size: 0.95rem;
}

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

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

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: modalIn var(--transition-normal);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-header i {
    font-size: 1.5rem;
    color: var(--accent-yellow);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.modal-body .filename {
    font-family: monospace;
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--accent-red);
    word-break: break-all;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .header-content {
        padding: 12px 16px;
    }

    .logo span {
        display: none;
    }

    .logo i {
        font-size: 2rem;
    }

    #logoutBtn span {
        display: none;
    }

    .main-content {
        padding: 20px 16px;
    }

    .download-section,
    .downloads-section {
        padding: 20px;
    }

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

    .input-group input {
        width: 100%;
    }

    .input-group .btn {
        width: 100%;
    }

    .download-item {
        flex-wrap: wrap;
    }

    .download-info {
        flex: 1 1 calc(100% - 64px);
    }

    .download-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
    }

    .download-meta {
        flex-wrap: wrap;
        gap: 8px 16px;
    }

    .login-card {
        padding: 28px 20px;
    }

    .notification {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .modal-content {
        padding: 24px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header .btn {
        width: 100%;
    }

    .user-info span {
        display: none;
    }
}

/* ========================================
   Animations
   ======================================== */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--accent-red);
    color: white;
}

/* Cookies Section */
.cookies-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.cookies-info {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.cookies-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cookies-form textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.85rem;
    resize: vertical;
}

.cookies-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.cookies-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cookies-status.success {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.cookies-status.warning {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}
