/**
 * Styles de l'application Gestion des Invités
 * Charte graphique inspirée du plan de table : Burgundy / Prune
 * Design mobile-first, boutons larges, contraste élevé
 */

/* === Variables & Reset === */
:root {
    --burgundy: #A82249;
    --plum: #6F0148;
    --plum-light: #8B1A5A;
    --plum-dark: #4A0130;
    --gold: #C8A96E;
    --gold-light: #E8D5A8;
    --cream: #FFF8F0;
    --white: #FFFFFF;
    --gray-light: #F5F0F2;
    --gray: #B0A0A8;
    --gray-dark: #5A4A52;
    --vert: #2E8B57;
    --vert-light: #E8F5E9;
    --rouge: #C0392B;
    --rouge-light: #FDEDEC;
    --ombre: 0 2px 8px rgba(111, 1, 72, 0.12);
    --ombre-forte: 0 4px 16px rgba(111, 1, 72, 0.2);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--cream);
    color: var(--plum-dark);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px; /* espace pour la nav bottom */
}

/* === Barre de statut connexion === */
.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background var(--transition), transform var(--transition);
}

.status-online {
    background: var(--vert);
    color: var(--white);
    transform: translateY(-100%);
}

.status-online.visible {
    transform: translateY(0);
}

.status-offline {
    background: var(--rouge);
    color: var(--white);
    transform: translateY(0);
}

.status-syncing {
    background: var(--gold);
    color: var(--plum-dark);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}

/* === Navigation bottom (mobile-first) === */
.nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    display: flex;
    background: var(--white);
    border-top: 2px solid var(--gold-light);
    box-shadow: 0 -2px 10px rgba(111, 1, 72, 0.1);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 6px;
    text-decoration: none;
    color: var(--gray);
    font-size: 0.7rem;
    font-weight: 500;
    transition: color var(--transition);
}

.nav-item.active {
    color: var(--plum);
}

.nav-item:active {
    background: var(--gray-light);
}

.nav-icon {
    font-size: 1.4rem;
    line-height: 1;
    margin-bottom: 2px;
}

.nav-label {
    letter-spacing: 0.02em;
}

/* === Contenu principal === */
.contenu {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--plum);
    margin-bottom: 16px;
    text-align: center;
}

.sous-titre {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--plum);
    margin: 24px 0 12px;
}

/* === Page Login === */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--plum-dark) 0%, var(--burgundy) 100%);
    padding-bottom: 0;
}

.login-container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 28px;
    width: 90%;
    max-width: 380px;
    box-shadow: var(--ombre-forte);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo-icon {
    font-size: 3rem;
    color: var(--burgundy);
    margin-bottom: 8px;
}

.login-logo h1 {
    font-size: 1.3rem;
    color: var(--plum);
    font-weight: 700;
}

.login-subtitle {
    color: var(--gray);
    font-size: 0.85rem;
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--plum);
    margin-bottom: 6px;
}

.login-form input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gold-light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color var(--transition);
    outline: none;
}

.login-form input[type="password"]:focus {
    border-color: var(--burgundy);
}

/* === Alertes === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-error {
    background: var(--rouge-light);
    color: var(--rouge);
    border: 1px solid var(--rouge);
}

.alert-success {
    background: var(--vert-light);
    color: var(--vert);
    border: 1px solid var(--vert);
}

/* === Boutons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--burgundy);
    color: var(--white);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--plum);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--plum);
    border: 2px solid var(--gold-light);
}

.btn-secondary:hover, .btn-secondary:focus {
    background: var(--gold-light);
}

.btn-success {
    background: var(--vert);
    color: var(--white);
}

.btn-danger {
    background: var(--rouge);
    color: var(--white);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
    border-radius: var(--radius);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* === Recherche === */
.recherche-container {
    position: relative;
    margin-bottom: 16px;
}

.input-recherche {
    width: 100%;
    padding: 16px 48px 16px 20px;
    border: 2px solid var(--gold-light);
    border-radius: var(--radius);
    font-size: 1.1rem;
    background: var(--white);
    color: var(--plum-dark);
    outline: none;
    box-shadow: var(--ombre);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-recherche:focus {
    border-color: var(--burgundy);
    box-shadow: var(--ombre-forte);
}

.input-recherche::placeholder {
    color: var(--gray);
}

.btn-effacer {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gray-light);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    color: var(--gray-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Résultats de recherche === */
.resultats-liste {
    list-style: none;
}

.resultat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    box-shadow: var(--ombre);
    cursor: pointer;
    transition: background var(--transition), transform 0.1s;
    border-left: 4px solid var(--gold);
}

.resultat-item:active {
    transform: scale(0.98);
    background: var(--gray-light);
}

.resultat-item.est-present {
    border-left-color: var(--vert);
}

.resultat-nom {
    font-weight: 600;
    color: var(--plum);
    font-size: 0.95rem;
}

.resultat-table {
    font-size: 0.8rem;
    color: var(--gray-dark);
    margin-top: 2px;
}

.resultat-statut {
    flex-shrink: 0;
    margin-left: 8px;
}

/* === Fiche invité === */
.fiche-invite {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--ombre-forte);
    margin-top: 16px;
    border-top: 4px solid var(--gold);
}

.fiche-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.fiche-nom {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--plum);
}

.fiche-table {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.fiche-label {
    font-size: 0.85rem;
    color: var(--gray-dark);
    font-weight: 500;
}

.fiche-valeur {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--plum);
}

.fiche-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-present {
    background: var(--vert-light);
    color: var(--vert);
}

.badge-absent {
    background: var(--rouge-light);
    color: var(--rouge);
}

.badge-complet {
    background: var(--vert);
    color: var(--white);
}

/* === Page Tables === */
.resume-bar {
    text-align: center;
    padding: 10px;
    background: var(--plum);
    color: var(--white);
    border-radius: var(--radius-sm);
    font-weight: 600;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.grille-tables {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.carte-table {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--ombre);
    border-left: 4px solid var(--gold);
    transition: border-color var(--transition);
}

.carte-table.table-complete {
    border-left-color: var(--vert);
}

.carte-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.carte-table-nom {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--plum);
}

.carte-table-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--gray-dark);
}

.carte-table-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.carte-table-stat strong {
    color: var(--plum);
}

.carte-table-barre {
    height: 8px;
    background: var(--gray-light);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.carte-table-barre-fill {
    height: 100%;
    background: var(--burgundy);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.carte-table-barre-fill.full {
    background: var(--vert);
}

/* === Page Stats === */
.stats-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--ombre);
}

.stat-card-accent {
    background: var(--plum);
    color: var(--white);
}

.stat-valeur {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat-card-accent .stat-valeur {
    color: var(--gold-light);
}

.stat-label {
    font-size: 0.8rem;
    margin-top: 4px;
    opacity: 0.85;
    font-weight: 500;
}

/* Barre de progression globale */
.progression-container {
    margin-bottom: 24px;
}

.progression-barre {
    height: 12px;
    background: var(--gray-light);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progression-remplissage {
    height: 100%;
    background: linear-gradient(90deg, var(--burgundy), var(--vert));
    border-radius: 6px;
    transition: width 0.6s ease;
}

/* Graphique en barres */
.graphique-barres {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.graphique-ligne {
    display: flex;
    align-items: center;
    gap: 8px;
}

.graphique-label {
    width: 90px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--plum);
    text-align: right;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.graphique-barre-container {
    flex: 1;
    height: 24px;
    background: var(--gray-light);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.graphique-barre-fill {
    height: 100%;
    background: var(--burgundy);
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 0;
}

.graphique-valeur {
    width: 40px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-dark);
    flex-shrink: 0;
}

/* Export */
.export-section {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--gold-light);
}

/* === Chargement === */
.chargement {
    text-align: center;
    padding: 24px;
    color: var(--gray);
    font-style: italic;
}

/* === Aucun résultat === */
.aucun-resultat {
    text-align: center;
    padding: 24px;
    color: var(--gray);
}

/* === Page Gestion === */
.gestion-bloc {
    margin-bottom: 20px;
}

.gestion-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--plum);
    margin-bottom: 6px;
}

.select-table {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gold-light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--white);
    color: var(--plum-dark);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236F0148' fill='none' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}

.select-table:focus {
    border-color: var(--burgundy);
}

.table-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.liste-invites-gestion {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.invite-gestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--ombre);
    border-left: 3px solid var(--gold);
    gap: 8px;
}

.invite-gestion-item.est-present {
    border-left-color: var(--vert);
}

.invite-gestion-nom {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--plum);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invite-gestion-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--transition), transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.btn-icon:active {
    transform: scale(0.9);
}

.btn-icon-transfer {
    background: var(--gold-light);
    color: var(--plum);
}

.btn-icon-delete {
    background: var(--rouge-light);
    color: var(--rouge);
}

/* Formulaire d'ajout */
.gestion-ajout {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--ombre);
    border-top: 3px solid var(--gold);
}

.gestion-ajout-titre {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--plum);
    margin-bottom: 10px;
}

.gestion-ajout-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-gestion {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gold-light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    outline: none;
    transition: border-color var(--transition);
}

.input-gestion:focus {
    border-color: var(--burgundy);
}

/* Modales */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(74, 1, 48, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-contenu {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--ombre-forte);
}

.modal-titre {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--plum);
    margin-bottom: 12px;
}

.modal-texte {
    font-size: 0.95rem;
    color: var(--gray-dark);
    margin-bottom: 16px;
    line-height: 1.5;
}

.modal-texte strong {
    color: var(--plum);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

/* Toast de notification */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
    box-shadow: var(--ombre-forte);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
    white-space: nowrap;
}

.toast-success { background: var(--vert); }
.toast-error { background: var(--rouge); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

.fade-in {
    animation: fadeIn 0.25s ease forwards;
}

/* === Media queries : tablettes et plus === */
@media (min-width: 480px) {
    .grille-tables {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 768px) {
    .contenu {
        max-width: 800px;
        padding: 24px;
    }

    .grille-tables {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .stats-cards {
        grid-template-columns: repeat(4, 1fr);
    }

    .page-title {
        font-size: 1.8rem;
    }
}
