/* === Editeasy V2 — REVILA Light Theme === */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    min-height: 100vh;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* --- Typography (serif titles) --- */
h1, h2, h3 {
    font-family: Georgia, 'Times New Roman', serif;
}

h1 {
    font-size: 2.4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: #1a1a1a;
}

h1 .v2 {
    color: #c4a57b;
    font-weight: 400;
    font-size: 1.4rem;
    vertical-align: super;
}

h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a1a1a;
}

.subtitle {
    text-align: center;
    color: #666666;
    margin-bottom: 32px;
    font-size: 0.95rem;
}

/* --- Sections & Accordion --- */
section {
    margin-top: 16px;
    background: #f5f3f0;
    border-radius: 12px;
    padding: 24px;
}

/* Summary line (hidden by default, shown when collapsed) */
.section-summary {
    display: none;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.section-summary:hover .summary-edit {
    text-decoration: underline;
}

.summary-check {
    color: #22c55e;
    font-weight: bold;
    font-size: 1.1rem;
}

.summary-text {
    flex: 1;
    color: #666;
}

.summary-edit {
    color: #c4a57b;
    font-size: 0.85rem;
}

/* Collapsed state */
section.collapsed {
    padding: 16px 24px;
}

section.collapsed .section-summary {
    display: flex;
}

section.collapsed .section-content {
    display: none;
}

/* Reveal animation */
section.revealing {
    animation: fadeIn 0.4s ease forwards;
}

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

/* Section header (title + tooltip) */
.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.section-header h2 {
    margin-bottom: 0;
}

/* Section nav (Suivant buttons) */
.section-nav {
    margin-top: 24px;
    text-align: right;
}

/* --- Dropzone --- */
.dropzone {
    border: 2px dashed #e0dcd7;
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #ffffff;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.05);
}

.dropzone-content svg {
    color: #c4a57b;
    margin-bottom: 12px;
}

.dropzone-content p {
    margin: 4px 0;
    color: #1a1a1a;
}

.dropzone-content .hint {
    color: #666666;
    font-size: 0.85rem;
}

/* --- File Strip (horizontal scrollable) --- */
.file-strip-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 16px;
}

.strip-scroll-btn {
    flex-shrink: 0;
    width: 36px;
    height: 60px;
    background: rgba(0,0,0,0.04);
    border: 1px solid #e0dcd7;
    border-radius: 8px;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.strip-scroll-btn:hover {
    background: rgba(196,165,123,0.12);
    color: #c4a57b;
    border-color: #c4a57b;
}

.strip-scroll-btn.hidden-arrow {
    opacity: 0;
    pointer-events: none;
}

.file-strip-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
    padding-bottom: 4px;
}

.file-strip-container::-webkit-scrollbar {
    height: 4px;
}

.file-strip-container::-webkit-scrollbar-track {
    background: transparent;
}

.file-strip-container::-webkit-scrollbar-thumb {
    background: #e0dcd7;
    border-radius: 2px;
}

.file-strip {
    display: flex;
    gap: 12px;
    padding: 8px 0;
}

.file-card {
    flex-shrink: 0;
    width: 120px;
    height: 100px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #e0dcd7;
    cursor: grab;
    border: 2px solid transparent;
    transition: border-color 0.2s, opacity 0.2s;
}

.file-card:active {
    cursor: grabbing;
}

.file-card.dragging {
    opacity: 0.4;
}

.file-card.drag-over {
    border-color: #c4a57b;
}

.file-card.shift-right {
    transform: translateX(calc(100% + 12px));
    transition: transform 0.25s ease;
}

.file-card.shift-left {
    transform: translateX(calc(-100% - 12px));
    transition: transform 0.25s ease;
}

.file-card.drag-placeholder {
    width: 120px;
    flex-shrink: 0;
    transition: width 0.25s ease;
}

.file-card.swap-left {
    transform: translateX(calc(-100% - 12px));
    transition: transform 0.25s ease;
}

.file-card.swap-right {
    transform: translateX(calc(100% + 12px));
    transition: transform 0.25s ease;
}

.file-card img,
.file-card .video-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-card .video-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0dcd7;
    color: #999;
}

.file-index {
    position: absolute;
    bottom: 4px;
    left: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
    pointer-events: none;
}

.file-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-remove:hover {
    background: rgba(231, 76, 60, 0.8);
}

.file-arrows {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
    pointer-events: none;
}

.file-card:hover .file-arrows {
    opacity: 1;
    pointer-events: auto;
}

.file-arrows button {
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.file-arrows button:hover {
    background: rgba(0,0,0,0.7);
}

/* --- File Gallery (grid view when order is off) --- */
.file-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.file-gallery .file-card {
    width: auto;
    min-width: 0;
    cursor: default;
}

.file-gallery .file-card .file-arrows {
    display: none;
}

.file-gallery .file-card .file-index {
    display: none;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 12px 32px;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s, opacity 0.2s;
    font-family: inherit;
}

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

.btn-primary {
    background: #c4a57b;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #b08f65;
}

.btn-secondary {
    background: transparent;
    color: #c4a57b;
    border: 1.5px solid #c4a57b;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(196, 165, 123, 0.1);
}

.btn-wide {
    width: 100%;
}

.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
}

/* --- Toggle Switch (iOS, gold) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.3s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.switch input:checked + .switch-slider {
    background: #c4a57b;
}

.switch input:checked + .switch-slider::before {
    transform: translateX(22px);
}

/* --- Toggle Row --- */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
    color: #1a1a1a;
}

/* --- Music Options (3 icon cards) --- */
.music-options {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.music-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.music-option:hover {
    border-color: #e0dcd7;
}

.music-option.selected {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.08);
}

.music-option svg {
    color: #c4a57b;
}

.music-option span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
}

.music-option small {
    font-size: 0.75rem;
    color: #666;
}

/* --- Info Tooltip --- */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.info-tooltip svg {
    color: #999;
}

.info-tooltip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    white-space: normal;
    width: max-content;
    max-width: 260px;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.info-tooltip:hover::after {
    opacity: 1;
}

/* --- Music Track List --- */
.music-track-list {
    margin-top: 12px;
    max-height: 280px;
    overflow-y: auto;
}

.music-loading,
.music-empty {
    color: #666;
    text-align: center;
    padding: 24px;
    font-size: 0.9rem;
}

.music-track {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.music-track:hover {
    background: #faf8f5;
}

.music-track.selected {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.08);
}

.music-track-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.music-track-name {
    font-size: 0.9rem;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-track-meta {
    font-size: 0.75rem;
    color: #888;
}

.music-play-btn {
    background: #f5f3f0;
    border: 1px solid #e0dcd7;
    color: #c4a57b;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 8px;
    transition: background 0.2s, border-color 0.2s;
}

.music-play-btn:hover {
    background: #ece9e4;
    border-color: #c4a57b;
}

/* --- Music Waveform --- */
.music-waveform-container {
    flex: 1;
    height: 40px;
    position: relative;
    cursor: pointer;
    margin: 0 12px;
    border-radius: 4px;
    overflow: hidden;
}

.music-waveform-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Custom Music Upload --- */
.music-custom-upload {
    margin-top: 12px;
}

.custom-music-label {
    cursor: pointer;
}

.custom-music-label input[type="file"] {
    display: none;
}

.custom-music-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #fff;
    border: 1.5px dashed #c4a57b;
    border-radius: 8px;
    color: #c4a57b;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-music-btn:hover {
    background: rgba(196, 165, 123, 0.08);
}

.custom-music-name {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #1a1a1a;
    font-weight: 500;
}

.hint {
    color: #666;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* --- Options: Pace --- */
.options-group {
    margin-bottom: 20px;
}

.options-group:last-child {
    margin-bottom: 0;
}

.options-group-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
    font-family: Georgia, 'Times New Roman', serif;
}

.pace-options {
    display: flex;
    gap: 12px;
}

.pace-option {
    flex: 1;
    padding: 14px 10px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.pace-option:hover {
    border-color: #e0dcd7;
}

.pace-option.selected {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.08);
}

.pace-option strong {
    display: block;
    font-size: 0.95rem;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.pace-option small {
    font-size: 0.78rem;
    color: #666;
}

.pace-estimate {
    font-size: 0.82rem;
    color: #999;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-left: 8px;
}

/* --- Orientation --- */
.orient-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1a1a1a;
}

.orient-info .checkmark {
    color: #22c55e;
    font-size: 1.2rem;
}

.orient-cards {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.orient-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: #fff;
    border: 2px solid #e0dcd7;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: #1a1a1a;
}

.orient-card:hover {
    border-color: #c4a57b;
}

.orient-card.selected {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.08);
}

.orient-card svg {
    color: #999;
}

.orient-card.selected svg {
    color: #c4a57b;
}

.orient-card span {
    font-size: 0.85rem;
    font-weight: 500;
}

.orient-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

/* --- Advanced Options --- */
.advanced-options {
    margin-top: 16px;
    border-top: 1px solid #e0dcd7;
    padding-top: 12px;
}

.advanced-options summary {
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
    padding: 4px 0;
    list-style: none;
    user-select: none;
}

.advanced-options summary::-webkit-details-marker {
    display: none;
}

.advanced-options summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s;
    font-size: 0.65rem;
}

.advanced-options[open] summary::before {
    transform: rotate(90deg);
}

.advanced-options .details-content {
    margin-top: 12px;
}

.advanced-options label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 6px;
}

.style-select {
    width: 100%;
    padding: 10px 14px;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e0dcd7;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 10px;
    transition: border-color 0.2s;
}

.style-select:hover,
.style-select:focus {
    border-color: #c4a57b;
    outline: none;
}

/* --- Consent --- */
.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
}

.consent-label input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #c4a57b;
}

/* --- Spinner --- */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0dcd7;
    border-top-color: #c4a57b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

/* --- Progress Bar --- */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0dcd7;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c4a57b, #d4b88e);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
}

/* --- Error --- */
.error-text {
    background: #fef2f2;
    color: #e74c3c;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* --- Done Section --- */
#section-done {
    text-align: center;
}

#section-done h2 {
    color: #22c55e;
}

.done-versions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.done-version {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.done-version h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
}

.video-preview {
    position: relative;
    display: flex;
    justify-content: center;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    min-height: 160px;
}

.video-preview video {
    width: 100%;
    max-width: 640px;
    display: block;
}

.ai-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 8px;
    z-index: 2;
}

.ai-loading-overlay p {
    color: #ccc;
    font-size: 0.85rem;
}

.ai-failed-msg {
    text-align: center;
    padding: 12px;
    color: #666;
    font-size: 0.85rem;
}

#section-done .btn {
    margin-bottom: 12px;
}

/* --- Actions Row --- */
.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.file-count {
    color: #666;
    font-size: 0.9rem;
}

/* --- Media Info --- */
.media-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: #1a1a1a;
}

.media-info .separator {
    color: #ccc;
}

/* --- Error Section --- */
#section-error {
    text-align: center;
}

/* --- Progress Section with Particles --- */
#section-progress {
    position: relative;
    overflow: hidden;
    min-height: 300px;
}

#particle-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    cursor: pointer;
}

#game-score {
    position: absolute;
    top: 10px;
    right: 16px;
    z-index: 2;
    font-size: 0.85rem;
    color: rgba(180, 160, 220, 0.7);
    font-weight: 600;
    letter-spacing: 0.5px;
    pointer-events: none;
    user-select: none;
}
#game-score-val {
    color: #a78bfa;
    font-variant-numeric: tabular-nums;
}

.progress-content {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .container {
        padding: 24px 12px;
    }

    h1 {
        font-size: 1.8rem;
    }

    section {
        padding: 20px 16px;
    }

    section.collapsed {
        padding: 14px 16px;
    }

    .music-options {
        flex-direction: column;
    }

    .pace-options {
        flex-direction: column;
    }

    .done-versions {
        grid-template-columns: 1fr;
    }

    .file-card {
        width: 100px;
        height: 85px;
    }

    .file-arrows {
        opacity: 1;
        pointer-events: auto;
    }

    .info-tooltip::after {
        left: auto;
        right: 0;
        transform: none;
    }
}
