/* Feuille de style de base. On l'étoffera avec les pages réelles. */

:root {
    --couleur-texte: #1a1a1a;
    --couleur-fond: #fafafa;
    --couleur-accent: #2b6cb0;
    --rayon: 6px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--couleur-texte);
    background: var(--couleur-fond);
    line-height: 1.5;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--rayon);
    border: 1px solid transparent;
}

.alert-success {
    background: #f0fff4;
    border-color: #9ae6b4;
    color: #22543d;
}

.alert-warning {
    background: #fffaf0;
    border-color: #fbd38d;
    color: #7b341e;
}

.alert-error {
    background: #fff5f5;
    border-color: #feb2b2;
    color: #742a2a;
}

/* En-tête et navigation. */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--couleur-texte);
    text-decoration: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-nav a {
    color: var(--couleur-accent);
    text-decoration: none;
}

.site-nav a:hover {
    text-decoration: underline;
}

.nav-user {
    color: #4a5568;
    font-size: 0.9rem;
}

.btn-link {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--couleur-accent);
    border-radius: var(--rayon);
}

/* Pied de page. */
.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.site-footer a {
    color: #4a5568;
}

/* Hero d'accueil. */
.hero {
    padding: 2rem 0;
}

.hero h1 {
    margin-bottom: 0.5rem;
}

/* Boutons. */
.btn,
button {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    border: 1px solid var(--couleur-accent);
    border-radius: var(--rayon);
    background: var(--couleur-accent);
    color: #fff;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover,
button:hover {
    filter: brightness(0.95);
}

.btn-secondary {
    background: #fff;
    color: var(--couleur-accent);
}

/* Formulaires. */
.form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 420px;
    margin-bottom: 1.5rem;
}

.form label {
    font-weight: 600;
    margin-top: 0.6rem;
}

.form label.checkbox {
    font-weight: 400;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    font-size: 0.92rem;
}

.form input[type="text"],
.form input[type="email"],
.form input[type="password"] {
    padding: 0.55rem 0.7rem;
    border: 1px solid #cbd5e0;
    border-radius: var(--rayon);
    font: inherit;
}

.form button {
    margin-top: 1rem;
    align-self: flex-start;
}

.intro {
    color: #4a5568;
}

.hint {
    color: #718096;
    font-size: 0.85rem;
    margin: 0.2rem 0 0.5rem;
}

/* En-tête de page avec action. */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Cartes du tableau de bord admin. */
.admin-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.card {
    display: block;
    padding: 1.2rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--rayon);
    background: #fff;
    text-decoration: none;
    color: inherit;
}

.card h2 {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    color: var(--couleur-accent);
}

.card p {
    margin: 0;
    color: #4a5568;
    font-size: 0.9rem;
}

.card-disabled {
    opacity: 0.55;
}

.card-disabled h2 {
    color: #718096;
}

/* Tableaux. */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: #fff;
}

.table th,
.table td {
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    font-size: 0.92rem;
    vertical-align: middle;
}

.table th {
    background: #f7fafc;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #4a5568;
}

.table .actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.table .actions form {
    margin: 0;
}

/* Ligne grisée : compte inéligible (déjà participant au concours). */
.table tr.row-disabled td {
    color: #a0aec0;
}

/* Badges de phase. */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-a_venir { background: #edf2f7; color: #4a5568; }
.badge-depot   { background: #ebf8ff; color: #2b6cb0; }
.badge-vote    { background: #fefcbf; color: #744210; }
.badge-cloture { background: #e6fffa; color: #234e52; }
.badge-rank     { background: var(--couleur-accent); color: #fff; }
.badge-favorite { background: #fed7e2; color: #97266d; }

/* Jauge d'avancement temporel d'un concours (carte de liste). */
.gauge {
    display: flex;
    height: 8px;
    margin-top: 0.8rem;
    border-radius: 999px;
    overflow: hidden;
    background: #edf2f7;
}

/* Une zone occupe une part de la barre proportionnelle à sa durée. Le fond vert
   clair de la zone de dépôt la distingue d'emblée de la zone de vote (violette),
   pour éviter de lire l'ensemble comme une seule jauge. */
.gauge-zone {
    position: relative;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
    background: #c6f6d5;
}

/* La zone de vote se distingue par un fond violet clair. */
.gauge-zone-vote {
    background: #e9d8fd;
}

/* Le remplissage matérialise le temps écoulé dans la zone. */
.gauge-fill {
    display: block;
    height: 100%;
}

.gauge-fill-green  { background: #38a169; }
.gauge-fill-yellow { background: #d69e2e; }
.gauge-fill-vote   { background: #805ad5; }

/* Les libellés d'échéance reprennent le découpage de la jauge : le texte des
   dépôts sous la zone verte, celui des votes sous la zone violette. */
.gauge-deadlines {
    display: flex;
    margin-top: 0.4rem;
}

.gauge-deadline {
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
    padding-right: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #718096;
}

/* On reprend la teinte soutenue de chaque jauge sur son mot clé. */
.gauge-word-depot { color: #38a169; font-weight: bold; }
.gauge-word-vote  { color: #805ad5; font-weight: bold; }

/* Boutons secondaires et dangereux. */
.btn-danger {
    background: #fff;
    color: #c53030;
    border-color: #fc8181;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

.btn-danger:hover {
    background: #fff5f5;
}

/* Formulaire large avec sections. */
.form-wide {
    max-width: 640px;
}

.form fieldset {
    border: 1px solid #e2e8f0;
    border-radius: var(--rayon);
    padding: 0.5rem 1rem 1rem;
    margin: 0 0 1rem;
}

.form legend {
    padding: 0 0.4rem;
    font-weight: 700;
    color: var(--couleur-accent);
}

.form textarea,
.form select,
.form input[type="number"],
.form input[type="datetime-local"] {
    padding: 0.55rem 0.7rem;
    border: 1px solid #cbd5e0;
    border-radius: var(--rayon);
    font: inherit;
    width: 100%;
}

.form input[disabled] {
    background: #edf2f7;
    color: #4a5568;
}

.alert ul {
    margin: 0;
    padding-left: 1.2rem;
}

/* Détail d'un concours. */
.contest-description {
    margin: 1rem 0;
}

.contest-dates {
    list-style: none;
    padding: 0;
    margin: 1rem 0 1.5rem;
    color: #4a5568;
    font-size: 0.92rem;
}

.contest-dates li {
    margin: 0.2rem 0;
}

/* Zone de dépôt et galerie des photos du participant. */
.deposit {
    margin-top: 1.5rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2rem;
    margin: 1rem 0 1.5rem;
}

.photo-card {
    margin: 0;
    padding: 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--rayon);
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.photo-card img {
    width: 100%;
    height: auto;
    border-radius: var(--rayon);
    display: block;
}

.photo-card figcaption {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.photo-card .form {
    max-width: none;
    margin: 0;
}

.photo-card details.photo-edit summary {
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--couleur-accent);
}

.photo-card details.photo-edit[open] summary {
    margin-bottom: 0.4rem;
}

.photo-card form {
    margin: 0;
}

/* Page de vote : sections, cartes votables, compteurs et saisies. */
.vote-section {
    margin: 1.5rem 0 2rem;
}

.vote-counter {
    font-weight: 600;
    color: #4a5568;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--rayon);
    padding: 0.5rem 0.8rem;
    display: inline-block;
}

/* Carte d'une photo en compétition : la vignette n'est pas cliquable au point
   de gêner le vote ; la case et la note se trouvent sous l'image. */
.vote-card.is-selected {
    border-color: var(--couleur-accent);
    box-shadow: 0 0 0 2px var(--couleur-accent) inset;
}

.vote-card .vote-choice,
.vote-card .vote-favorite {
    cursor: pointer;
}

.vote-card .jury-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.vote-card .jury-note input[type="number"] {
    width: 5rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid #cbd5e0;
    border-radius: var(--rayon);
    font: inherit;
}

.vote-card input:disabled {
    cursor: not-allowed;
}

/* Galerie d'exposition : badges de rang/coup de cœur et mention de l'auteur. */
.expo-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.2rem;
}

.expo-author {
    color: #718096;
    font-size: 0.85rem;
    font-style: italic;
}

/* Grille de dépôt par emplacements (slots). */
.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2rem;
    margin: 1rem 0 1.5rem;
}

.slot {
    margin: 0;
}

.slot-form {
    margin: 0;
}

/* Emplacement vide : zone de dépôt cliquable avec son numéro. */
.slot-dropzone {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    text-align: center;
    background: #fff;
    border: 2px dashed #cbd5e0;
    border-radius: var(--rayon);
    color: #a0aec0;
    cursor: pointer;
}

.slot-dropzone:hover,
.slot-dropzone.is-dragover {
    border-color: var(--couleur-accent);
    color: var(--couleur-accent);
    background: #f7fbff;
}

.slot-number {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
}

.slot-hint {
    font-size: 0.8rem;
}

/* Emplacement rempli : image, métadonnées et remplacement. */
.slot-filled {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--rayon);
    background: #fff;
}

.slot-image {
    position: relative;
}

.slot-image img {
    width: 100%;
    height: auto;
    border-radius: var(--rayon);
    display: block;
}

/* Croix de suppression : révélée au survol de l'image. */
.slot-delete-form {
    margin: 0;
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
}

.slot-delete {
    width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: #c53030;
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.slot-image:hover .slot-delete,
.slot-delete:focus {
    opacity: 1;
}

.slot-delete:hover {
    background: #9b2c2c;
}

.slot-meta-form {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.slot-title,
.slot-caption {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid #cbd5e0;
    border-radius: var(--rayon);
    font: inherit;
}

.slot-meta-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.slot-save {
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
}

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

.slot-saved {
    font-size: 0.78rem;
    color: #22543d;
}
