/* ============================================================================
   Le Studio de l'Arche — Feuille de style
   Aesthetic : refined minimalism, editorial dark, classical/luxury
   ============================================================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg { max-width: 100%; display: block; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
ol, ul { list-style: none; }

/* --- Design tokens --- */
:root {
    /* Couleurs : dégradés profonds de noir vers gris, avec un point chaud */
    --bg-deep:       #050505;
    --bg-base:       #0a0a0a;
    --bg-card:       #131313;
    --bg-elevated:   #1a1a1a;
    --bg-pure-black: #000000;

    --border-subtle: #1f1f1f;
    --border-soft:   #2a2a2a;
    --border-strong: #3a3a3a;

    /* Texte : tons crème plutôt que blanc pur, pour la chaleur */
    --text-primary:   #ece8e0;
    --text-secondary: #9a958d;
    --text-muted:     #5a5650;
    --text-faint:     #3a3833;

    /* Accent : un or pâle, discret */
    --accent:        #b8a47a;
    --accent-dim:    #6b5f44;

    /* Sémantiques */
    --success: #7a9d6f;
    --warning: #c19a5e;
    --error:   #b8654d;

    /* Espacements */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    --sp-7: 48px;
    --sp-8: 64px;
    --sp-9: 96px;

    /* Typo */
    --font-serif: "Iowan Old Style", "Apple Garamond", Garamond, "Times New Roman", Georgia, serif;
    --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono:  ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    /* Transitions */
    --t-fast: 120ms ease;
    --t-base: 220ms ease;
    --t-slow: 400ms ease;
}

/* --- Base --- */
html, body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

body {
    background-image:
        radial-gradient(ellipse at top, rgba(40, 30, 20, 0.08), transparent 50%),
        radial-gradient(ellipse at bottom, rgba(20, 25, 35, 0.05), transparent 50%);
    background-attachment: fixed;
}

.page-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--sp-7) var(--sp-5) var(--sp-6);
    min-height: calc(100vh - 80px);
}

@media (max-width: 600px) {
    .page-wrapper { padding: var(--sp-5) var(--sp-4) var(--sp-5); }
}

/* --- Site footer --- */
.site-footer {
    text-align: center;
    padding: var(--sp-5);
    color: var(--text-faint);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ============================================================================
   HERO — page d'accueil neutre
   ============================================================================ */
.hero {
    text-align: center;
    padding: var(--sp-9) var(--sp-4);
    animation: fadeIn 800ms ease-out;
}
.hero-logo {
    width: 220px;
    height: auto;
    margin: 0 auto var(--sp-6);
    filter: drop-shadow(0 4px 16px rgba(184, 164, 122, 0.15));
}
.hero-subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--accent);
    letter-spacing: 0.05em;
    margin-bottom: var(--sp-5);
}
.hero-text {
    color: var(--text-secondary);
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.8;
}

/* ============================================================================
   AUTH — formulaire mot de passe
   ============================================================================ */
.auth-container {
    max-width: 420px;
    margin: var(--sp-9) auto 0;
    text-align: center;
    animation: fadeIn 600ms ease-out;
}
.auth-logo {
    width: 140px;
    height: auto;
    margin: 0 auto var(--sp-6);
}
.auth-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.7rem;
    letter-spacing: 0.02em;
    margin-bottom: var(--sp-2);
    color: var(--text-primary);
}
.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: var(--sp-6);
    line-height: 1.6;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.auth-form input[type="password"],
.auth-form input[type="text"] {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 2px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color var(--t-base), background var(--t-base);
    text-align: center;
    letter-spacing: 0.02em;
}
.auth-form input:focus {
    border-color: var(--accent-dim);
    background: var(--bg-elevated);
}
.auth-form input::placeholder { color: var(--text-muted); }

.auth-form button,
.btn-primary {
    background: var(--text-primary);
    color: var(--bg-deep);
    border: none;
    border-radius: 2px;
    padding: 14px 24px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all var(--t-base);
}
.auth-form button:hover,
.btn-primary:hover {
    background: var(--accent);
    transform: translateY(-1px);
}
.auth-form button:active,
.btn-primary:active { transform: translateY(0); }

/* --- Messages --- */
.error-message {
    background: rgba(184, 101, 77, 0.1);
    border: 1px solid rgba(184, 101, 77, 0.3);
    color: var(--error);
    padding: var(--sp-3) var(--sp-4);
    border-radius: 2px;
    font-size: 0.9rem;
    margin-bottom: var(--sp-4);
}
.success-message {
    background: rgba(122, 157, 111, 0.1);
    border: 1px solid rgba(122, 157, 111, 0.3);
    color: var(--success);
    padding: var(--sp-3) var(--sp-4);
    border-radius: 2px;
    font-size: 0.9rem;
    margin-bottom: var(--sp-4);
}

/* ============================================================================
   PLAYER
   ============================================================================ */
.player-page {
    animation: fadeIn 500ms ease-out;
}

/* En-tête : logo + infos album */
.player-header {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    padding-bottom: var(--sp-5);
    margin-bottom: var(--sp-6);
    border-bottom: 1px solid var(--border-subtle);
}
.player-logo {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    object-fit: contain;
}
.player-album-info { flex: 1; min-width: 0; }
.player-album-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.7rem;
    line-height: 1.2;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    margin-bottom: var(--sp-1);
}
.player-album-artist {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-top: 2px;
    line-height: 1.5;
}
.player-album-composer {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
}
.player-album-artist em,
.player-album-composer em {
    font-style: italic;
    color: var(--text-secondary);
    font-weight: 400;
    margin-right: 2px;
}

@media (max-width: 600px) {
    .player-header { gap: var(--sp-4); }
    .player-logo   { width: 72px; height: 72px; }
    .player-album-title { font-size: 1.35rem; }
}

/* Lecteur : "now playing" */
.player-controls {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: var(--sp-5);
    margin-bottom: var(--sp-6);
    position: sticky;
    top: var(--sp-3);
    z-index: 10;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(19, 19, 19, 0.95);
}
.now-playing {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
    padding-bottom: var(--sp-5);
    border-bottom: 1px solid var(--border-subtle);
}
.now-playing-num {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 2rem;
    color: var(--accent);
    width: 48px;
    text-align: center;
    flex-shrink: 0;
}
.now-playing-info { flex: 1; min-width: 0; }
.now-playing-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: var(--sp-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.now-playing-meta {
    color: var(--text-primary);
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
}
.now-playing-meta em {
    font-style: italic;
    color: var(--text-secondary);
    margin-right: 2px;
}

/* Contrôles */
.custom-controls {
    display: grid;
    grid-template-columns: auto auto auto 1fr auto;
    align-items: center;
    gap: var(--sp-3);
}
@media (max-width: 600px) {
    .custom-controls {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "prev play next"
            "progress progress progress"
            "volume volume volume";
        gap: var(--sp-3);
    }
    #btn-prev { grid-area: prev; }
    #btn-play { grid-area: play; }
    #btn-next { grid-area: next; }
    .progress-container { grid-area: progress; }
    .volume-container   { grid-area: volume; }
}

.ctrl-btn {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-base);
}
.ctrl-btn:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
    background: rgba(184, 164, 122, 0.08);
}
.ctrl-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.ctrl-btn-main {
    width: 56px;
    height: 56px;
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-deep);
}
.ctrl-btn-main:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-deep);
}

/* Barre de progression */
.progress-container {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 0;
}
.time-elapsed, .time-total {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    min-width: 38px;
    text-align: center;
    flex-shrink: 0;
}
.progress-bar {
    flex: 1;
    height: 24px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.progress-bar::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 2px;
    background: var(--border-soft);
    transform: translateY(-50%);
    border-radius: 2px;
}
.progress-bar-fill {
    position: absolute;
    left: 0; top: 50%;
    height: 2px;
    background: var(--accent);
    transform: translateY(-50%);
    width: 0%;
    border-radius: 2px;
    transition: background var(--t-fast);
}
.progress-bar-handle {
    position: absolute;
    top: 50%;
    width: 10px; height: 10px;
    background: var(--accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    left: 0;
    opacity: 0;
    transition: opacity var(--t-base);
    pointer-events: none;
}
.progress-bar:hover .progress-bar-handle,
.progress-bar.is-active .progress-bar-handle { opacity: 1; }
.progress-bar:hover .progress-bar-fill {
    background: var(--text-primary);
}

/* Volume */
.volume-container {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
#volume {
    -webkit-appearance: none;
    appearance: none;
    width: 70px;
    height: 2px;
    background: var(--border-soft);
    border-radius: 2px;
    outline: none;
}
#volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px; height: 10px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}
#volume::-moz-range-thumb {
    width: 10px; height: 10px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Liste des pistes */
.tracklist { display: flex; flex-direction: column; }
.track-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: var(--sp-4);
    align-items: center;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background var(--t-fast);
}
.track-item:hover {
    background: var(--bg-card);
}
.track-item.is-playing {
    background: rgba(184, 164, 122, 0.05);
}
.track-item.is-playing .track-num {
    color: var(--accent);
}
.track-item.is-playing .track-title {
    color: var(--accent);
}

.track-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    transition: color var(--t-fast);
}
.track-info { min-width: 0; }
.track-title {
    font-size: 0.98rem;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--t-fast);
}
.track-credit {
    color: var(--text-primary);
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.88;
}
.track-credit em {
    font-style: italic;
    color: var(--text-secondary);
    margin-right: 2px;
}
.track-duration {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Durée totale de l'album, en bas à droite */
.album-total-duration {
    text-align: right;
    padding: var(--sp-4) var(--sp-4) 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}
.album-total-duration .duration-value {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    margin-left: var(--sp-1);
}

.empty-state {
    text-align: center;
    padding: var(--sp-8);
    color: var(--text-secondary);
    font-style: italic;
}

/* ============================================================================
   ADMIN
   ============================================================================ */
.admin-page { animation: fadeIn 400ms ease-out; }
.admin-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: var(--sp-4);
    margin-bottom: var(--sp-6);
    border-bottom: 1px solid var(--border-subtle);
}
.admin-header h1 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.6rem;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}
.logout-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: color var(--t-base);
}
.logout-link:hover { color: var(--accent); }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--sp-5);
}
.admin-table th {
    text-align: left;
    padding: var(--sp-3) var(--sp-3);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-soft);
}
.admin-table th small {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    color: var(--text-muted);
}
.admin-table td {
    padding: var(--sp-3);
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle);
}
.admin-table input[type="text"] {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 2px;
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.92rem;
    outline: none;
    transition: border-color var(--t-base);
}
.admin-table input[type="text"]:focus {
    border-color: var(--accent-dim);
    background: var(--bg-elevated);
}
.album-num {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--accent);
    font-size: 1.1rem;
    width: 32px;
    text-align: center;
}
.track-count { font-size: 0.85rem; white-space: nowrap; }
.status-ok   { color: var(--success); }
.status-warn { color: var(--warning); }

.link-col {
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    white-space: nowrap;
}
.album-link {
    text-decoration: none;
    color: var(--text-secondary);
    transition: color var(--t-base);
}
.album-link:hover { color: var(--accent); }
.copy-btn {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-secondary);
    padding: 4px 10px;
    margin-left: var(--sp-2);
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.72rem;
    transition: all var(--t-base);
}
.copy-btn:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
}

.admin-actions {
    display: flex;
    justify-content: flex-end;
    padding: var(--sp-4) 0;
}

.admin-help {
    margin-top: var(--sp-7);
    padding: var(--sp-5);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
}
.admin-help h3 {
    font-family: var(--font-serif);
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: var(--sp-3);
    font-size: 1.1rem;
}
.admin-help ul { padding-left: var(--sp-5); list-style: disc; }
.admin-help code {
    background: var(--bg-elevated);
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 0.85em;
    color: var(--accent);
}

@media (max-width: 700px) {
    .admin-table thead { display: none; }
    .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
    .admin-table tr {
        border: 1px solid var(--border-subtle);
        padding: var(--sp-3);
        margin-bottom: var(--sp-3);
        border-radius: 4px;
    }
    .admin-table td { border-bottom: none; padding: var(--sp-2) 0; }
    .admin-table td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.08em;
        display: block;
        margin-bottom: var(--sp-1);
    }
}

/* --- Setup page --- */
.setup-container {
    max-width: 600px;
    margin: var(--sp-7) auto;
    padding: var(--sp-6);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    line-height: 1.8;
}
.setup-container h2 {
    font-family: var(--font-serif);
    font-weight: 400;
    margin-bottom: var(--sp-4);
    color: var(--text-primary);
}
.setup-container p, .setup-container li { color: var(--text-secondary); margin-bottom: var(--sp-2); }
.setup-container ol { padding-left: var(--sp-5); }
.setup-container code {
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 2px;
    color: var(--accent);
    font-size: 0.9em;
}
.setup-container .warning {
    margin-top: var(--sp-4);
    padding: var(--sp-3);
    background: rgba(193, 154, 94, 0.08);
    border-left: 2px solid var(--warning);
    color: var(--warning);
    font-size: 0.88rem;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
