/**
 * Planning Stand de Tir — Styles front-end
 */

/* ==========================================================================
   Container
   ========================================================================== */

.pst-auth-container,
.pst-planning-container,
.pst-history-container {
    color: #142026;
}

.pst-auth-container {
    max-width: 480px;
    margin: 2em auto;
    padding: 0 1em;
}

/* ==========================================================================
   Typographie
   ========================================================================== */

.pst-title {
    font-size: 1.5em;
    margin-bottom: 0.5em;
}

.pst-description {
    color: #555;
    margin-bottom: 1.5em;
}

.pst-hint {
    display: block;
    font-size: 0.85em;
    color: #888;
    margin-top: 4px;
}

/* ==========================================================================
   Messages
   ========================================================================== */

.pst-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 1.5em;
    font-size: 0.95em;
    line-height: 1.5;
}

.pst-message-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.pst-message-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.pst-message-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.pst-message a {
    color: #BA1F23;
}

/* ==========================================================================
   Formulaires
   ========================================================================== */

.pst-form {
    margin-bottom: 1em;
}

.pst-form-group {
    margin-bottom: 1.2em;
}

.pst-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.95em;
}

.pst-input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.pst-input:focus {
    outline: none;
    border-color: #BA1F23;
    box-shadow: 0 0 0 2px rgba(186, 31, 35, 0.15);
}

/* Champ mot de passe avec toggle visibilité */
.pst-password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.pst-password-wrapper .pst-input {
    flex: 1;
    padding-right: 84px;
}

/* Lien texte Afficher / Masquer dans le champ.
   Sélecteurs qualifiés button.* pour passer devant les styles button du thème. */
button.pst-password-toggle,
button.pst-password-toggle:hover,
button.pst-password-toggle:focus {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    outline: none;
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7A858B;
    cursor: pointer;
}

button.pst-password-toggle:hover {
    color: #BA1F23;
}

/* ==========================================================================
   Boutons
   ========================================================================== */

/* Classes .pst-btn : ajustables depuis le site.
   Sélecteurs qualifiés a/button/span pour passer devant les styles button du thème. */
a.pst-btn,
button.pst-btn,
span.pst-btn {
    display: inline-block;
    padding: 12px 26px;
    font-family: "Bricolage Grotesque", sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s, color 0.2s;
}

a.pst-btn--primary,
button.pst-btn--primary {
    background: #BA1F23;
    border-color: #BA1F23;
    color: #FFFFFF;
}

a.pst-btn--primary:hover,
button.pst-btn--primary:hover {
    background: #9E1A1E;
    border-color: #9E1A1E;
    color: #FFFFFF;
    text-decoration: none;
}

a.pst-btn--secondary,
button.pst-btn--secondary,
span.pst-btn--secondary {
    background: transparent;
    border-color: #BA1F23;
    color: #BA1F23;
}

a.pst-btn--secondary:hover,
button.pst-btn--secondary:hover {
    background: #BA1F23;
    color: #FFFFFF;
    text-decoration: none;
}

span.pst-btn--disabled {
    color: #aaa;
    border-color: #ddd;
    cursor: default;
    pointer-events: none;
}

/* ==========================================================================
   Liens
   ========================================================================== */

.pst-link {
    margin-top: 1em;
    font-size: 0.9em;
}

.pst-link a {
    color: #BA1F23;
    text-decoration: none;
}

.pst-link a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Dashboard adhérent
   ========================================================================== */

.pst-dashboard {
    text-align: center;
}

.pst-nav {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1.5em 0;
}

.pst-dashboard .pst-link {
    margin-top: 2em;
}

/* ==========================================================================
   Barre navigation utilisateur (planning + historique)
   ========================================================================== */

.pst-user-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    background: #FFFFFF;
    border: 1px solid #E5E0D5;
    border-radius: 14px;
    margin-bottom: 1.5em;
    font-size: 0.9em;
}

.pst-user-nav-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.pst-user-nav-links a {
    color: #BA1F23;
    text-decoration: none;
}

.pst-user-nav-links a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Planning adhérent : grille semaine
   ========================================================================== */

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

/* Navigation semaines */
.pst-planning-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 1em 0;
}

.pst-planning-week {
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
}

.pst-planning-today {
    text-align: center;
    font-size: 0.9em;
    margin: 0 0 1em;
}

.pst-planning-today a {
    color: #BA1F23;
    text-decoration: none;
}

.pst-planning-today a:hover {
    text-decoration: underline;
}

/* Légende */
.pst-planning-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin: 1em 0;
    font-size: 0.85em;
    color: #555;
}

.pst-legend-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid #ccc;
    vertical-align: middle;
    margin-right: 4px;
}

.pst-swatch-closed {
    background: #f0f0f1;
}

.pst-swatch-yellow {
    background: #fef3c7;
}

.pst-swatch-green {
    background: #d1fae5;
}

.pst-swatch-red {
    background: #fee2e2;
}

.pst-swatch-full {
    background: #fee2e2;
}

.pst-swatch-mine {
    background: #dbeafe;
}

/* Grille wrapper (scroll horizontal sur mobile) */
.pst-planning-grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1em 0;
}

/* Table grille */
.pst-planning-grid {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
    table-layout: fixed;
    font-size: 0.85em;
}

.pst-planning-grid th {
    background: #f8f9fa;
    padding: 8px 4px;
    text-align: center;
    border: 1px solid #ddd;
    font-weight: 600;
}

.pst-pgrid-day-name {
    display: block;
    font-size: 0.95em;
}

.pst-pgrid-day-date {
    display: block;
    font-size: 0.8em;
    color: #888;
    font-weight: 400;
}

/* Cellules préfixées .pst-planning-grid td : le reset de Hello Elementor
   (table tbody>tr:nth-child(odd)>td) écrase sinon le fond une ligne sur deux. */
.pst-planning-grid td.pst-pgrid-hour,
.pst-pgrid-hour {
    background: #f8f9fa;
    padding: 6px 8px;
    text-align: center;
    white-space: nowrap;
    font-weight: 600;
    border: 1px solid #ddd;
    width: 60px;
}

/* Cellules planning */
.pst-pcell {
    height: 40px;
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
    padding: 2px 4px;
    position: relative;
}

.pst-planning-grid td.pst-pcell-closed {
    background: #f0f0f1;
    color: #bbb;
}

.pst-planning-grid td.pst-pcell-yellow {
    background: #fef3c7;
    cursor: default;
}

.pst-planning-grid td.pst-pcell-green {
    background: #d1fae5;
    cursor: default;
}

.pst-planning-grid td.pst-pcell-red {
    background: #fee2e2;
    color: #991b1b;
}

.pst-planning-grid td.pst-pcell-full {
    background: #fee2e2;
    color: #991b1b;
}

.pst-planning-grid td.pst-pcell-mine {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.pst-pcell-mine.pst-pcell-no-cancel {
    cursor: not-allowed;
    opacity: 0.85;
}

.pst-cancel-btn {
    display: block;
    font-size: 0.7em;
    font-weight: 700;
    color: #dc2626;
    cursor: pointer;
    margin-top: 2px;
    text-decoration: underline;
}

.pst-cancel-btn:hover {
    color: #991b1b;
}

/* Contenu cellules */
.pst-pcell-places {
    font-size: 0.9em;
    color: #555;
}

/* Compteur réservations X/9 */
.pst-pcell-count {
    font-size: 0.85em;
    color: #888;
}

.pst-count-low {
    font-size: 1.1em;
    font-weight: 700;
    color: #16a34a;
}

.pst-count-medium {
    font-size: 1.1em;
    font-weight: 700;
    color: #ea580c;
}

.pst-count-high {
    font-size: 1.1em;
    font-weight: 700;
    color: #dc2626;
}

.pst-pcell-label {
    font-size: 0.85em;
}

.pst-pcell-rental {
    display: inline-block;
    font-size: 0.75em;
    font-weight: 700;
    color: #1e40af;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 2px;
    padding: 0 3px;
    margin-left: 2px;
}

.pst-pcell-pending-badge {
    display: inline-block;
    font-size: 0.85em;
    margin-right: 2px;
}

/* Cellules cliquables */
.pst-pcell[data-avail="available"]:hover {
    filter: brightness(0.92);
}

.pst-pcell[data-avail="mine"]:hover {
    filter: brightness(0.92);
}

/* ==========================================================================
   Modale réservation / annulation
   ========================================================================== */

.pst-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1em;
}

.pst-modal {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.pst-modal-large {
    max-width: 500px;
}

.pst-modal-title {
    margin: 0 0 8px;
    font-size: 1.2em;
}

.pst-modal-info {
    color: #555;
    margin: 0 0 16px;
    font-size: 0.95em;
}

.pst-modal-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.95em;
    cursor: pointer;
}

.pst-modal-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.pst-modal-hint {
    font-size: 0.8em;
    color: #888;
    margin: 0 0 16px;
}

.pst-rental-warning {
    color: #dc2626;
    font-weight: 600;
}

.pst-modal-label {
    font-weight: 600;
    margin: 0 0 8px;
    font-size: 0.95em;
}

.pst-modal-lanes {
    margin-bottom: 16px;
}

.pst-lanes-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px;
}

.pst-lane-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin: 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.pst-lane-option:hover {
    background: #f8f9fa;
}

.pst-lane-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.pst-lane-label {
    font-size: 0.9em;
}

.pst-lane-taken {
    opacity: 0.5;
    cursor: not-allowed;
}

.pst-lane-taken:hover {
    background: transparent;
}

.pst-lane-taken em {
    color: #dc2626;
    font-size: 0.85em;
}

.pst-lane-highlight .pst-lane-label {
    font-weight: 700;
}

.pst-modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pst-modal-confirm {
    flex: 1;
}

.pst-modal-danger {
    flex: 1;
    background: #dc2626;
    color: #fff;
    border: none;
    padding: 10px 24px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
}

.pst-modal-danger:hover {
    background: #b91c1c;
}

.pst-modal-cancel {
    flex: 0;
    white-space: nowrap;
}

/* ==========================================================================
   Dialog notification (remplace les toast)
   ========================================================================== */

.pst-dialog-icon {
    font-size: 2em;
    width: 50px;
    height: 50px;
    line-height: 50px;
    border-radius: 50%;
    text-align: center;
    margin: 0 auto 12px;
    color: #fff;
}

.pst-dialog-icon-success {
    background: #166534;
}

.pst-dialog-icon-error {
    background: #991b1b;
}

.pst-dialog-icon-warning {
    background: #b45309;
}

.pst-dialog-message {
    font-size: 0.95em;
    text-align: center;
    margin: 0 0 16px;
    line-height: 1.4;
}

button.pst-dialog-ok {
    display: block;
    margin: 0 auto;
    min-width: 80px;
}

/* Legacy toast (conservé pour rétrocompat) */

.pst-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 500;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.pst-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.pst-toast-success {
    background: #166534;
    color: #fff;
}

.pst-toast-error {
    background: #991b1b;
    color: #fff;
}

/* ==========================================================================
   Historique adhérent [pst_history]
   ========================================================================== */

.pst-history-container {
    max-width: 700px;
    margin: 2em auto;
    padding: 0 1em;
}

.pst-history-grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1em 0;
}

.pst-history-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9em;
}

.pst-history-table th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    border: 1px solid #ddd;
    font-weight: 600;
    white-space: nowrap;
}

.pst-history-table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    vertical-align: middle;
}

.pst-history-cancelled {
    opacity: 0.6;
}

.pst-status-confirmed {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    background: #d1fae5;
    color: #166534;
}

.pst-status-cancelled {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    background: #fee2e2;
    color: #991b1b;
}

.pst-status-pending {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
}

.pst-history-pending {
    background: #fffbeb;
}

.pst-history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 1.5em 0;
}

.pst-history-page-info {
    font-size: 0.9em;
    color: #555;
}

/* ==========================================================================
   Responsive : mobile
   ========================================================================== */

@media (max-width: 640px) {
    .pst-planning-container {
        padding: 0 0.5em;
    }

    .pst-planning-nav {
        gap: 8px;
    }

    .pst-planning-nav .pst-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .pst-planning-week {
        font-size: 0.95em;
        width: 100%;
        text-align: center;
        order: -1;
    }

    .pst-planning-grid {
        font-size: 0.75em;
        min-width: 500px;
    }

    .pst-pgrid-hour {
        width: 45px;
        padding: 4px 2px;
    }

    .pst-pcell {
        height: 34px;
        padding: 1px 2px;
    }

    .pst-planning-legend {
        font-size: 0.75em;
        gap: 10px;
    }
}
