/* =========================================================
   Mini-CMS audio — feuille de styles partagée
   ========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
    background-color: #fafafa;
    color: #1a1a1a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================================================
   Page neutre racine + pages thèmes (lecteur)
   ========================================================= */

body.player {
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body.blank {
    overflow: hidden;
}

.player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    max-width: 420px;
    width: 100%;
}

.player-title {
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.player-subtitle {
    font-size: 15px;
    font-weight: 400;
    color: #8a8a8a;
    margin-bottom: 64px;
    letter-spacing: -0.01em;
}

.play-button {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background-color: #1a1a1a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background-color 0.2s ease;
    position: relative;
    outline: none;
    margin-bottom: 40px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.play-button:active {
    transform: scale(0.95);
    background-color: #2a2a2a;
}

.play-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.play-icon {
    width: 0;
    height: 0;
    border-top: 22px solid transparent;
    border-bottom: 22px solid transparent;
    border-left: 34px solid #ffffff;
    margin-left: 8px;
    transition: opacity 0.15s ease;
}

.pause-icon {
    display: none;
    width: 36px;
    height: 42px;
    position: relative;
}

.pause-icon::before,
.pause-icon::after {
    content: '';
    position: absolute;
    top: 0;
    width: 11px;
    height: 100%;
    background-color: #ffffff;
    border-radius: 2px;
}

.pause-icon::before { left: 4px; }
.pause-icon::after  { right: 4px; }

.play-button.playing .play-icon  { display: none; }
.play-button.playing .pause-icon { display: block; }

.progress-container {
    width: 100%;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background-color: #e5e5e5;
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: #1a1a1a;
    border-radius: 2px;
    transition: width 0.1s linear;
}

.time-display {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: #8a8a8a;
    letter-spacing: 0.02em;
    font-weight: 400;
}

.error-message {
    display: none;
    font-size: 14px;
    color: #c0392b;
    margin-top: 24px;
    padding: 12px 20px;
    background-color: rgba(192, 57, 43, 0.06);
    border-radius: 8px;
    max-width: 280px;
}

.error-message.visible { display: block; }

@media (max-width: 360px) {
    .player-title { font-size: 24px; }
    .play-button { width: 120px; height: 120px; margin-bottom: 32px; }
    .play-icon {
        border-top-width: 18px;
        border-bottom-width: 18px;
        border-left-width: 28px;
    }
    .player-subtitle { margin-bottom: 48px; }
}

/* =========================================================
   Panel admin
   ========================================================= */

body.admin {
    background-color: #f5f5f7;
    color: #1a1a1a;
    min-height: 100%;
    display: block;
}

.admin-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 24px;
    border-bottom: 1px solid #e5e5ea;
    margin-bottom: 24px;
}

.admin-header h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.admin-header nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-header nav a,
.admin-header nav button {
    font: inherit;
    color: #1a1a1a;
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.admin-header nav a:hover,
.admin-header nav button:hover {
    background: #ebebef;
}

.admin-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e5ea;
    padding: 24px;
    margin-bottom: 16px;
}

.admin-card h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
}

.admin-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

table.themes {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.themes th, table.themes td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f3;
    vertical-align: middle;
}

table.themes th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6e6e73;
    background: #fafafc;
}

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

table.themes td.actions {
    white-space: nowrap;
    text-align: right;
}

.btn {
    display: inline-block;
    font: inherit;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #d1d1d6;
    background: #ffffff;
    color: #1a1a1a;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { background: #f0f0f3; }

.btn-primary {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #1a1a1a;
}

.btn-primary:hover { background: #2a2a2a; }

.btn-danger {
    color: #c0392b;
    border-color: #f3c4be;
    background: #fff;
}
.btn-danger:hover { background: #fdf1ef; }

.btn-sm { padding: 5px 10px; font-size: 13px; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
}

.badge.active   { background: #e6f7ed; color: #1d7a3a; border-color: #c2ecd1; }
.badge.inactive { background: #f0f0f3; color: #6e6e73; border-color: #e5e5ea; }

.badge.toggle {
    cursor: pointer;
    background: none;
    font: inherit;
}

.icon-yes { color: #1d7a3a; font-weight: 700; }
.icon-no  { color: #c0392b; font-weight: 700; }

.empty {
    padding: 48px 16px;
    text-align: center;
    color: #6e6e73;
    font-size: 14px;
}

/* Formulaires */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #1a1a1a;
}

.form-group .help {
    font-size: 12px;
    color: #6e6e73;
    margin-top: 4px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: #ffffff;
}

.form-group input:focus {
    outline: none;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.flash.error   { background: #fdecea; color: #a8281a; border: 1px solid #f5c2bb; }
.flash.success { background: #e6f7ed; color: #1d7a3a; border: 1px solid #c2ecd1; }
.flash.info    { background: #eaf3fc; color: #1a4a8a; border: 1px solid #b8d4f0; }

/* Login + setup */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: #ffffff;
    padding: 32px;
    border-radius: 12px;
    border: 1px solid #e5e5ea;
    width: 100%;
    max-width: 380px;
}

.auth-card h1 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-card .lead {
    font-size: 13px;
    color: #6e6e73;
    margin-bottom: 24px;
}

/* Modale QR */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}
.modal-backdrop.open { display: flex; }

.modal {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    max-width: 460px;
    width: 100%;
    text-align: center;
}

.modal h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal .url {
    font-size: 12px;
    color: #6e6e73;
    word-break: break-all;
    margin-bottom: 16px;
}

.modal img {
    max-width: 100%;
    height: auto;
    border: 1px solid #e5e5ea;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}

.modal .modal-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.muted { color: #6e6e73; font-size: 13px; }
