/* =============================================
   MODAL.CSS — Dark theme · Paleta violeta
   Consistente con clubInfo.css y results
============================================= */

/* ── Variables locales (fallbacks si no vienen del root) ── */
:root {
    --modal-bg:       #13152b;
    --modal-bg-body:  #0f1124;
    --modal-border:   rgba(255, 255, 255, 0.07);
    --modal-radius:   16px;
    --modal-accent:   #a855f7;
    --modal-accent-p: #7c3aed;
    --modal-text:     rgba(255, 255, 255, 0.88);
    --modal-muted:    #b9b3d2;
    --modal-input-bg: rgba(255, 255, 255, 0.04);
    --modal-danger:   #ef4444;
    --modal-success:  #10b981;
    --modal-warning:  #f59e0b;
    --modal-primary:  #7c3aed;
}

/* =============================================
   BACKDROP
============================================= */
.modal-backdrop.show {
    opacity: 0.65;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* =============================================
   MODAL CONTENT — card oscura
============================================= */
.modal-content {
    background: var(--modal-bg, #13152b);
    border: 1px solid var(--modal-border, rgba(255,255,255,0.07));
    border-radius: var(--modal-radius, 16px);
    box-shadow:
        0 32px 64px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(168, 85, 247, 0.08);
    overflow: clip;
    color: var(--modal-text);
    position: relative;
}

/* =============================================
   HEADER
============================================= */
.modal-header {
    border-bottom: 1px solid var(--modal-border);
    padding: 1.1rem 1.5rem;
    gap: 0.75rem;
    background: transparent;
    position: relative; /* AGREGAR */
}

/* Línea de acento superior */
.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: var(--modal-radius) var(--modal-radius) 0 0;
    background: linear-gradient(
        90deg,
        var(--modal-accent-p),
        var(--modal-accent),
        transparent
    );
}

.modal-title {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Ícono opcional en el título */
.modal-title i {
    font-size: 1.1rem;
    color: var(--modal-accent-p);
}

/* btn-close sobre fondo oscuro */
.modal-header .btn-close {
    filter: invert(1);
    opacity: 0.45;
    transition: opacity 0.2s;
}
.modal-header .btn-close:hover {
    opacity: 0.9;
}

/* ── Variantes semánticas del header ── */
.modal-header.modal-primary::before  { background: linear-gradient(90deg, var(--modal-accent-p), var(--modal-accent), transparent); }
.modal-header.modal-danger::before   { background: linear-gradient(90deg, var(--modal-danger), #f87171, transparent); }
.modal-header.modal-success::before  { background: linear-gradient(90deg, var(--modal-success), #34d399, transparent); }
.modal-header.modal-warning::before  { background: linear-gradient(90deg, var(--modal-warning), #fcd34d, transparent); }

/* Badge de tipo (danger / warning) en el título */
.modal-header.modal-danger  .modal-title i { color: #f87171; }
.modal-header.modal-success .modal-title i { color: #34d399; }
.modal-header.modal-warning .modal-title i { color: #fcd34d; }
/* .modal-header.modal-primary .modal-title i { color: #818cf8; } */

/* =============================================
   BODY
============================================= */
.modal-body {
    padding: 1.5rem;
    background: var(--modal-bg-body, #0f1124);
    color: var(--modal-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    overflow: visible;
}

.modal-body .row {
    overflow: visible;
}

/* Párrafos de advertencia / info */
.modal-body > p:first-child {
    color: var(--modal-text);
    margin-bottom: 1.25rem;
}

/* ── Separador interno ── */
.modal-body hr {
    border-color: var(--modal-border);
    opacity: 1;
    margin: 1.25rem 0;
}

/* ── Alerta / info box dentro del modal ── */
.modal-body .modal-alert {
    background: rgba(168, 85, 247, 0.07);
    border: 1px solid rgba(168, 85, 247, 0.18);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
    color: var(--modal-muted);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}
.modal-body .modal-alert i {
    color: var(--modal-accent);
    flex-shrink: 0;
    margin-top: 1px;
}

/* =============================================
   FORMULARIOS
============================================= */
.modal-body .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--modal-muted);
    margin-bottom: 0.45rem;
}

.modal-body .form-control,
.modal-body .form-select {
    background: var(--modal-input-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
    padding: 0.6rem 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-body .form-control::placeholder {
    color: rgba(185, 179, 210, 0.4);
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
    color: #fff;
    outline: none;
}

/* Select dark */
.modal-body .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23b9b3d2' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 16px 12px;
}

.modal-body .form-select option {
    background: #1a1d3a;
    color: #fff;
}

/* Textarea sin resize */
.modal-body textarea.form-control {
    resize: none;
}

/* Helper text */
.modal-body .form-text,
.modal-body .text-muted {
    font-size: 0.75rem;
    color: rgba(185, 179, 210, 0.55) !important;
    margin-top: 0.3rem;
}

/* Switch */
.modal-body .form-check-input {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    cursor: pointer;
}
.modal-body .form-check-input:checked {
    background-color: var(--modal-accent);
    border-color: var(--modal-accent);
}
.modal-body .form-check-label {
    color: var(--modal-muted);
    font-size: 0.875rem;
}

/* Input file */
.modal-body input[type="file"].form-control {
    padding: 0.5rem 0.75rem;
    color: var(--modal-muted);
    cursor: pointer;
}
.modal-body input[type="file"].form-control::-webkit-file-upload-button {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 6px;
    color: var(--modal-accent);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 12px;
    margin-right: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.modal-body input[type="file"].form-control::-webkit-file-upload-button:hover {
    background: rgba(168, 85, 247, 0.22);
}

/* Preview de imágenes */
.image-wrapper img {
    border-radius: 10px;
    border: 1px solid rgba(168, 85, 247, 0.2);
    object-fit: cover;
    max-height: 160px;
    width: 100%;
}
.gallery-preview img {
    height: 100px;
    width: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

/* =============================================
   FOOTER
============================================= */
.modal-footer {
    border-top: 1px solid var(--modal-border);
    padding: 1rem 1.5rem;
    background: var(--modal-bg);
    gap: 0.6rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* ── Botones del modal ── */

/* Cancelar */
.btn-modal-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--modal-muted);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-modal-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Primary */
.btn-modal-primary {
    background: linear-gradient(135deg, var(--modal-primary), var(--modal-accent));
    border: none;
    color: #fff;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
}
.btn-modal-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 18px rgba(168, 85, 247, 0.35);
    transform: translateY(-1px);
    color: #fff;
}
.btn-modal-primary:active {
    transform: translateY(0);
}

/* Danger */
.btn-modal-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: none;
}
.btn-modal-danger:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.65);
    filter: brightness(1.1);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
    color: #fca5a5;
}

/* Fallback de padding limpio para botones de modal que no lleven la clase .btn de Bootstrap */
.btn-modal-cancel:not(.btn),
.btn-modal-primary:not(.btn),
.btn-modal-danger:not(.btn) {
    padding: 0.375rem 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Bootstrap .btn-danger override para consistencia */
.modal-footer .btn.btn-danger {
    background: var(--modal-danger);
    border-color: var(--modal-danger);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
    transition: all 0.2s;
}
.modal-footer .btn.btn-danger:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

/* =============================================
   ANIMACIÓN DE ENTRADA
============================================= */
.modal.fade .modal-dialog {
    transform: translateY(20px) scale(0.98);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.2s ease;
}
.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

/* =============================================
   RESPONSIVE
============================================= */
@media (max-width: 576px) {
    .modal-body {
        padding: 1.25rem 1rem;
    }
    .modal-header {
        padding: 1rem;
    }
    .modal-footer {
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
    }
    .modal-footer .btn-modal-cancel,
    .modal-footer .btn-modal-primary,
    .modal-footer .btn-modal-danger,
    .modal-footer .btn.btn-danger {
        width: 100%;
        justify-content: center;
    }

    #amenitiesModal .modal-footer,
    #editClubModal .modal-footer,
    #deactivateClubModal .modal-footer,
    #activateClubModal .modal-footer {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }
    #amenitiesModal .modal-footer .btn-modal-cancel,
    #amenitiesModal .modal-footer .btn-modal-primary,
    #editClubModal .modal-footer .btn-modal-cancel,
    #editClubModal .modal-footer .btn-modal-primary,
    #deactivateClubModal .modal-footer .btn-modal-cancel,
    #deactivateClubModal .modal-footer .btn-danger,
    #activateClubModal .modal-footer .btn-modal-cancel,
    #activateClubModal .modal-footer .btn-danger {
        flex: 1;
        width: auto !important;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: 0;
    }
}

.modal-field-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--modal-muted);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
}

.modal-field-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff !important;
}

.modal-body .status-pill {
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.875rem;
    font-size: 0.8rem;
    font-weight: 700;          
    line-height: 1;
}

/* =============================================
   MAPA EN MODALES
============================================= */

.modal-body .leaflet-container {
    background: #1a1d3a;
    border-radius: 10px;
}

.club-map-container {
    min-height: 300px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(168, 85, 247, 0.2);
    transition: border-color 0.2s;
}

.club-map-container:focus-within {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
}

/* Feedback de dirección bajo el mapa */
.map-address-feedback {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: rgba(168, 85, 247, 0.07);
    border: 1px solid rgba(168, 85, 247, 0.18);
    border-radius: 8px;
    padding: 0.6rem 0.875rem;
    font-size: 0.8rem;
    color: var(--modal-muted);
}

.map-address-feedback i {
    color: var(--modal-accent);
    flex-shrink: 0;
    margin-top: 1px;
}

.map-input-group {
    position: relative;
}

.map-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10060;
    background: #1a1d3a;
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.map-suggestions:empty { display: none; }

.map-suggestion-item {
    padding: 0.6rem 0.875rem;
    font-size: 0.8rem;
    color: var(--modal-muted);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}

.map-suggestion-item:last-child { border-bottom: none; }

.map-suggestion-item:hover {
    background: rgba(168, 85, 247, 0.12);
    color: #fff;
}

.map-suggestion-item i {
    color: var(--modal-accent);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Botón de geolocalización */
.btn-geo {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: var(--modal-accent);
    border-radius: 8px;
    padding: 0.4rem 0.875rem;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-geo:hover {
    background: rgba(168, 85, 247, 0.16);
    border-color: rgba(168, 85, 247, 0.45);
    color: #c084fc;
}

.btn-geo i { font-size: 0.85rem; }

/* Botón outline-secondary dentro del modal (lupa) */
.modal-body .btn-outline-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--modal-muted);
    transition: all 0.2s;
}

.modal-body .btn-outline-secondary:hover {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.35);
    color: var(--modal-accent);
}