:root {
    --primary: #00ffa9;
    --primary-light: #33ffbc;
    --text-dark: #f5f5f7;
    --text-light: #a1a1a6;
    --bg-white: #0f0f0f;
    --bg-light: #1a1a1a;
    --bg-lighter: #2a2a2a;
    --border: #3a3a3a;
    --border-light: #2a2a2a;
}

@media (prefers-color-scheme: light) {
    :root {
        --text-dark: #0a0e27;
        --text-light: #6b7280;
        --bg-white: #ffffff;
        --bg-light: #f9fafb;
        --bg-lighter: #f3f4f6;
        --border: #e5e7eb;
        --border-light: #f0f0f0;
    }
}

html[data-theme="light"] {
    --text-dark: #0a0e27;
    --text-light: #6b7280;
    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --bg-lighter: #f3f4f6;
    --border: #e5e7eb;
    --border-light: #f0f0f0;
}

html[data-theme="dark"] {
    --text-dark: #f5f5f7;
    --text-light: #a1a1a6;
    --bg-white: #0f0f0f;
    --bg-light: #1a1a1a;
    --bg-lighter: #2a2a2a;
    --border: #3a3a3a;
    --border-light: #2a2a2a;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-white);
    color: var(--text-dark);
    padding: 20px;
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

main {
    max-width: 700px;
    margin: 0 auto;
}

/* Header */
.app-header {
    margin-bottom: 56px;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

.header-content {
    padding: 48px 20px;
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--primary);
    letter-spacing: -1.5px;
    line-height: 1.1;
}

.header-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    z-index: 100;
}

.theme-toggle:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 255, 169, 0.12);
}

/* Container */
.container {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Alerte liée aux cookies d'authentification */
.cookie-alert {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    border: 1px solid;
    border-radius: 12px;
    animation: fadeIn 0.4s ease-out;
}

.cookie-alert[hidden] {
    display: none;
}

.cookie-alert-critical {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.35);
    border-color: #ef4444;
}

.cookie-alert-warning {
    color: #fef3c7;
    background: rgba(120, 53, 15, 0.35);
    border-color: #f59e0b;
}

html[data-theme="light"] .cookie-alert-critical {
    color: #991b1b;
    background: #fef2f2;
}

html[data-theme="light"] .cookie-alert-warning {
    color: #92400e;
    background: #fffbeb;
}

/* Card - Minimalist */
.card {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: slideUpSmooth 0.7s ease-out;
}

.card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 255, 169, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.progress-card {
    background: var(--bg-white);
    border-color: var(--border-light);
}

.progress-card:hover {
    border-color: var(--primary);
}

/* Section Title */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-dark);
    letter-spacing: -0.3px;
}

/* Typography */
h2 {
    color: var(--text-dark);
}

h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-dark);
}

/* Form */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Button */
button {
    padding: 13px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--primary);
    color: #0f0f0f;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(0, 255, 169, 0.12);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.5s ease;
}

button:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 255, 169, 0.18);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(0);
    background: #00e699;
    box-shadow: 0 2px 4px rgba(0, 255, 169, 0.12);
}

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

.btn-primary {
    align-self: flex-start;
    margin-top: 8px;
}

/* Input - Clean Style */
textarea, input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    background: var(--bg-white);
    color: var(--text-dark);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
}

textarea::placeholder, input::placeholder {
    color: var(--text-light);
}

textarea:hover, input:hover {
    background: var(--bg-lighter);
    border-color: var(--border);
}

textarea:focus, input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-lighter);
    box-shadow: 0 0 0 3px rgba(0, 255, 169, 0.1), 0 2px 8px rgba(0, 255, 169, 0.08);
}

/* Textarea specific */
#urlsInput {
    font-family: 'Fira Code', 'Courier New', monospace;
    resize: vertical;
    min-height: 120px;
}

/* Textarea Wrapper */
.textarea-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.paste-btn {
    position: absolute;
    right: 14px;
    top: 14px;
    padding: 8px 16px;
    font-size: 0.8rem;
    background: var(--bg-lighter);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    font-weight: 500;
    box-shadow: none;
    z-index: 1;
    letter-spacing: 0.3px;
}

.paste-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #0f0f0f;
    box-shadow: 0 2px 8px rgba(0, 255, 169, 0.12);
    transform: translateY(-1px);
}

.paste-btn:active {
    transform: translateY(0);
    background: #00e699;
}

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

/* Progress Container */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-label {
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.95rem;
}

.progress-status {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.05rem;
}

/* Progress Bar */
.bar {
    width: 100%;
    height: 6px;
    background: var(--bg-lighter);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.bar-inner {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 12px rgba(0, 255, 169, 0.3);
}

/* Result Output */
#result {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    min-height: 60px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-light);
    white-space: pre-wrap;
    word-break: break-word;
    display: none;
}

.result-output {
    background: var(--bg-white);
}

#result:not(:empty) {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* Table Wrapper */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Videos Table */
.videos-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-light);
}

.videos-table thead {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
}

.videos-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.4px;
}

.videos-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    color: var(--text-dark);
}

.videos-table tbody tr:last-child td {
    border-bottom: none;
}

.videos-table tbody tr {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.videos-table tbody tr:hover {
    background: var(--bg-white);
}

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

.video-status.status-pending {
    color: var(--text-light);
}

.video-status.status-processing {
    color: var(--primary);
    animation: pulse 1.5s infinite;
}

.video-status.status-success {
    color: #10b981;
}

.video-status.status-error {
    color: #ef4444;
}

.video-progress {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
}

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

@keyframes slideUpSmooth {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Download Link */
#downloadBtn {
    text-decoration: none;
    display: none;
}

#downloadBtn[href] {
    display: block;
}

#downloadLabel {
    width: 100%;
}

/* Format Options */
.format-options {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-dark);
    user-select: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.checkbox-label:hover {
    color: var(--primary);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Footer discret (lien admin) */
.app-footer {
    max-width: 700px;
    margin: 40px auto 0;
    text-align: center;
}

.footer-link {
    color: var(--text-light);
    font-size: 0.8rem;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.footer-link:hover {
    opacity: 1;
    color: var(--primary);
}

/* Page d'administration */
.btn-secondary {
    background: var(--bg-lighter);
    color: var(--text-dark);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--bg-lighter);
    color: var(--primary);
    box-shadow: none;
    transform: none;
}

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.admin-panel-header .section-title {
    margin-bottom: 0;
}

.cookie-block-title {
    margin-top: 32px;
}

.cookie-upload-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cookie-status-line {
    color: var(--text-light);
    font-size: 0.9rem;
}

.cookie-upload-form {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.cookie-upload-form input[type="file"] {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
}

.upload-divider {
    color: var(--text-light);
    font-size: 0.8rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cookie-paste-form {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.cookie-paste-form textarea {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 90px;
}

.cookie-paste-form button {
    align-self: flex-start;
}

.admin-note {
    color: var(--text-light);
}

.ytdlp-update-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.ytdlp-output {
    width: 100%;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-message {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.admin-message-error {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.35);
    border: 1px solid #ef4444;
}

.admin-message-success {
    color: #bbf7d0;
    background: rgba(6, 78, 59, 0.35);
    border: 1px solid #10b981;
}

html[data-theme="light"] .admin-message-error {
    color: #991b1b;
    background: #fef2f2;
}

html[data-theme="light"] .admin-message-success {
    color: #065f46;
    background: #ecfdf5;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        margin-bottom: 40px;
    }

    h1 {
        font-size: 2.5rem;
    }

    .card {
        padding: 28px;
        border-radius: 14px;
    }

    .container {
        gap: 24px;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .app-header {
        margin-bottom: 32px;
        padding: 32px 0;
    }

    h1 {
        font-size: 2rem;
    }

    .header-subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 20px;
        border-radius: 12px;
    }

    .section-title {
        font-size: 1.1rem;
        margin-bottom: 18px;
    }

    button {
        padding: 11px 22px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    textarea, input {
        padding: 12px 14px;
        font-size: 16px;
        border-radius: 10px;
    }

    .paste-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        border-radius: 6px;
    }

    .videos-table th,
    .videos-table td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        top: 12px;
        right: 12px;
    }
}
