/**
 * gesf-form-concurs.css
 * Disseny compartit pels formularis de concursos (Federacio + Club)
 * Maritime = blau (#0369a1) | Continental = porpra (#3730a3)
 */

/* ===== OVERLAY DEL MODAL ===== */
.gesf-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99990;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    backdrop-filter: blur(3px);
}
.gesf-modal-overlay.active {
    display: flex;
}

/* ===== CONTENIDOR DEL MODAL ===== */
.gesf-modal-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 860px;
    margin: auto;
    overflow: hidden;
    animation: gesf-modal-in 0.25s ease;
}
@keyframes gesf-modal-in {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)     scale(1);    }
}

/* ===== CAPCALERA DEL MODAL ===== */
.gesf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px;
    color: #fff;
}
.gesf-modal-header.mar   { background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%); }
.gesf-modal-header.cont  { background: linear-gradient(135deg, #3730a3 0%, #4f46e5 100%); }

.gesf-modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.gesf-modal-title small {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 2px;
}
.gesf-modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s;
    flex-shrink: 0;
}
.gesf-modal-close:hover { background: rgba(255,255,255,0.3); }

/* ===== COS DEL MODAL ===== */
.gesf-modal-body {
    padding: 28px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

/* ===== AVIS INFORMATIU ===== */
.gesf-form-aviso {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    border-left: 4px solid;
}
.gesf-form-aviso.warning {
    background: #fff8e1;
    border-color: #f59e0b;
    color: #856404;
}
.gesf-form-aviso.info {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

/* ===== GRID DEL FORMULARI ===== */
.gesf-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.gesf-form-grid .span2 { grid-column: span 2; }
.gesf-form-grid .span1 { grid-column: span 1; }

/* ===== GRUP DE CAMP ===== */
.gesf-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.gesf-form-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
}

/* ===== INPUTS / SELECTS / TEXTAREA ===== */
.gesf-input,
.gesf-select,
.gesf-textarea {
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
    color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
}
.gesf-input:focus,
.gesf-select:focus,
.gesf-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.gesf-input[readonly],
.gesf-input:disabled,
.gesf-select:disabled {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}
.gesf-textarea { resize: vertical; min-height: 70px; }

/* ===== CHECKBOX ROW ===== */
.gesf-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
}
.gesf-checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0369a1;
    flex-shrink: 0;
}
.gesf-checkbox-row span {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

/* ===== DIVISOR ===== */
.gesf-form-divider {
    grid-column: span 2;
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 4px 0;
}

/* ===== SECCIO TITOL ===== */
.gesf-section-title {
    grid-column: span 2;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    margin-bottom: -4px;
}

/* ===== BOTONS DEL FORMULARI ===== */
.gesf-form-actions {
    grid-column: span 2;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
    margin-top: 4px;
}
.gesf-btn {
    padding: 10px 22px;
    border-radius: 10px;
    border: none;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: opacity 0.15s, transform 0.1s;
}
.gesf-btn:active { transform: scale(0.97); }
.gesf-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}
.gesf-btn-secondary:hover { background: #e5e7eb; }
.gesf-btn-primary-mar {
    background: linear-gradient(135deg, #0369a1, #0284c7);
    color: #fff;
}
.gesf-btn-primary-cont {
    background: linear-gradient(135deg, #3730a3, #4f46e5);
    color: #fff;
}
.gesf-btn-primary-mar:hover,
.gesf-btn-primary-cont:hover { opacity: 0.9; }
.gesf-btn-warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #fff;
}
.gesf-btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
}

/* ===== INDICADOR DE CARREGA ===== */
.gesf-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gesf-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes gesf-spin { to { transform: rotate(360deg); } }

/* ===== MISSATGE FLASH ===== */
.gesf-flash-msg {
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 16px;
    border-left: 4px solid;
    display: none;
}
.gesf-flash-msg.show { display: block; }
.gesf-flash-msg.success { background: #f0fdf4; border-color: #22c55e; color: #15803d; }
.gesf-flash-msg.error   { background: #fef2f2; border-color: #ef4444; color: #dc2626; }
.gesf-flash-msg.info    { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .gesf-form-grid { grid-template-columns: 1fr; }
    .gesf-form-grid .span2 { grid-column: span 1; }
    .gesf-modal-body { padding: 16px; }
}

/* ===================================================================
   MODAL DEL CALENDARI WEB PÚBLIC D'OCUPACIÓ
   =================================================================== */

/* ===== OVERLAY DEL CALENDARI WEB (SOBRE EL FORMULARI) ===== */
.gesf-cal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(5px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.gesf-cal-overlay.active {
    display: flex !important;
}

/* ===== CONTENIDOR DEL MODAL CALENDARI WEB ===== */
.gesf-cal-modal-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
    width: 96vw;
    max-width: 1440px;
    height: 92vh;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: gesf-modal-in 0.25s ease;
}

/* ===== CAPÇALERA DEL CALENDARI WEB ===== */
.gesf-cal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    color: #fff;
    flex-shrink: 0;
}
.gesf-cal-modal-header.mar  { background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%); }
.gesf-cal-modal-header.cont { background: linear-gradient(135deg, #3730a3 0%, #4f46e5 100%); }

.gesf-cal-header-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.gesf-cal-modal-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}
.gesf-cal-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.gesf-cal-modal-header small {
    font-size: 0.78rem;
    opacity: 0.88;
    font-weight: 500;
    color: #f1f5f9;
}

.gesf-cal-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.gesf-cal-btn-ext {
    color: #fff;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 7px 14px;
    border-radius: 8px;
    transition: background 0.15s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.gesf-cal-btn-ext:hover {
    background: rgba(255, 255, 255, 0.32);
    color: #fff;
    transform: translateY(-1px);
}
.gesf-cal-close {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gesf-cal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ===== COS DEL CALENDARI WEB (IFRAME) ===== */
.gesf-cal-modal-body {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
}
#gesf-cal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    display: block;
}
.gesf-cal-loading {
    position: absolute;
    inset: 0;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
}

/* ===== TARGETA D'AJUDA DINS DEL FORMULARI ===== */
.gesf-cal-helper-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1.5px solid #a7f3d0;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    margin-bottom: 6px;
    box-sizing: border-box;
}
.gesf-cal-helper-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.gesf-cal-helper-icon {
    font-size: 1.7rem;
    flex-shrink: 0;
    line-height: 1;
}
.gesf-cal-helper-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gesf-cal-helper-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: #065f46;
}
.gesf-cal-helper-desc {
    font-size: 0.8rem;
    color: #047857;
    line-height: 1.35;
}
.gesf-btn-cal-helper {
    padding: 9px 18px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
    flex-shrink: 0;
}
.gesf-btn-cal-helper:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.35);
}

/* ===== ENLLAÇ RÀPID AL COSTAT DEL LABEL DATA INICI ===== */
.gesf-form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.gesf-link-cal-quick {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: none;
    letter-spacing: normal;
    transition: all 0.15s ease;
}
.gesf-link-cal-quick:hover {
    background: #d1fae5;
    color: #047857;
    border-color: #6ee7b7;
    transform: translateY(-1px);
}

/* ===== BOTÓ A LA CAPÇALERA DEL MODAL FORMULARI ===== */
.gesf-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.gesf-btn-header-calendari {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}
.gesf-btn-header-calendari:hover {
    background: rgba(255, 255, 255, 0.32);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

@media (max-width: 768px) {
    .gesf-cal-helper-card {
        flex-direction: column;
        align-items: stretch;
    }
    .gesf-btn-cal-helper {
        justify-content: center;
    }
    .gesf-cal-modal-box {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .gesf-cal-overlay {
        padding: 0;
    }
}