/* Modal base */
.fir-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.fir-modal:not([style*="display: none"]) {
    display: flex !important;
}

.fir-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.fir-modal-card {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
}

.fir-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    z-index: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.fir-modal-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Header */
#fir-modal-title {
    margin: 0;
    padding: 20px 60px 20px 20px;
    font-size: 1.5em;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
}

/* Indicador de pasos */
.fir-steps {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.fir-steps li {
    flex: 1;
    padding: 15px 20px;
    text-align: center;
    font-weight: 500;
    color: #666;
    position: relative;
    transition: all 0.3s ease;
}

.fir-steps li.is-active {
    color: #007cba;
    background: white;
    border-bottom: 3px solid #007cba;
}

.fir-steps li:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 30px;
    background: #ddd;
}

/* Cuerpo de pasos */
.fir-steps-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.fir-step {
    display: none;
    padding: 30px;
    min-height: 400px;
}

.fir-step.is-active {
    display: block;
}

/* Resumen */
.fir-resumen-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007cba;
}

.fir-resumen-content h4 {
    margin: 0 0 15px 0;
    color: #007cba;
    font-size: 1.3em;
}

.fir-resumen-content p {
    margin: 8px 0;
    color: #555;
}

.fir-resumen-content strong {
    color: #333;
}

/* Formularios */
.fir-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.fir-field {
    display: flex;
    flex-direction: column;
}

.fir-field label {
    font-weight: 500;
    margin-bottom: 5px;
    color: #333;
    font-size: 0.9em;
}

.fir-field input,
.fir-field select,
.fir-field textarea {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: white;
}

.fir-field input:focus,
.fir-field select:focus,
.fir-field textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.fir-field input.error,
.fir-field select.error {
    border-color: #dc3545;
}

.fir-field input:invalid {
    border-color: #dc3545;
}

.fir-field .error-message {
    color: #dc3545;
    font-size: 0.8em;
    margin-top: 4px;
}

.fir-field-wide {
    grid-column: 1 / -1;
}

/* Tabs de alumnos */
#fir-alumno-tabs {
    margin-bottom: 30px;
}

.fir-tablist {
    display: flex;
    list-style: none;
    margin: 0 0 20px 0;
    padding: 0;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
}

.fir-tablist li {
    margin: 0;
}

.fir-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.fir-tab:hover {
    color: #007cba;
    background: #f8f9fa;
}

.fir-tab.is-active {
    color: #007cba;
    border-bottom-color: #007cba;
    background: white;
    font-weight: 500;
}

/* Forzar visibilidad del contenedor de tabs */
.fir-tabs-container {
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
    display: block !important;
}

/* Forzar visibilidad del contenido del modal */
.fir-modal-content {
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
    display: block !important;
}

.fir-tabpanels {
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
    display: block !important;
}

.fir-tabpanel {
    display: none;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 300px;
}

.fir-tabpanel.is-active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    padding: 20px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
}

/* Regla más específica para forzar visibilidad */
.fir-modal-card .fir-tabpanels .fir-tabpanel.is-active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    padding: 20px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
}

/* Botones */
.fir-step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    margin-top: 20px;
}

.fir-btn-back,
.fir-btn-next,
.fir-btn-primary {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.fir-btn-back {
    background: #6c757d;
    color: white;
}

.fir-btn-back:hover {
    background: #5a6268;
}

.fir-btn-next,
.fir-btn-primary {
    background: #007cba;
    color: white;
}

.fir-btn-next:hover,
.fir-btn-primary:hover {
    background: #005a87;
}

.fir-btn-primary {
    background: #28a745;
    font-size: 16px;
    padding: 14px 28px;
}

.fir-btn-primary:hover {
    background: #218838;
}

/* Estados de carga */
.fir-btn-loading {
    position: relative;
    color: transparent !important;
}

.fir-btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .fir-modal {
        padding: 10px;
    }

    .fir-modal-card {
        max-height: 95vh;
    }

    #fir-modal-title {
        padding: 15px 50px 15px 15px;
        font-size: 1.3em;
    }

    .fir-steps li {
        padding: 12px 10px;
        font-size: 0.9em;
    }

    .fir-step {
        padding: 20px 15px;
        min-height: 300px;
    }

    .fir-form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .fir-tablist {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .fir-tab {
        padding: 10px 15px;
        font-size: 13px;
    }

    .fir-step-actions {
        flex-direction: column;
        gap: 10px;
    }

    .fir-btn-back,
    .fir-btn-next,
    .fir-btn-primary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .fir-steps li {
        padding: 10px 8px;
        font-size: 0.8em;
    }

    .fir-step {
        padding: 15px 10px;
    }

    .fir-form-grid {
        gap: 12px;
    }

    .fir-field input,
    .fir-field select,
    .fir-field textarea {
        padding: 10px;
        font-size: 16px;
        /* Evita zoom en iOS */
    }
}

/* Animaciones */
.fir-step {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Validaciones visuales */
.fir-field input:valid:not(:placeholder-shown) {
    border-color: #28a745;
}

.fir-field input:invalid:not(:placeholder-shown) {
    border-color: #dc3545;
}

/* Indicadores de progreso */
.fir-steps li::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e0e0e0;
    margin-right: 8px;
    vertical-align: middle;
    transition: all 0.3s;
}

.fir-steps li.is-active::before {
    background: #007cba;
    color: white;
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Mejoras de accesibilidad */
.fir-modal[aria-hidden="false"] {
    visibility: visible;
}

.fir-modal[aria-hidden="true"] {
    visibility: hidden;
}

.fir-tab:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.fir-btn-back:focus,
.fir-btn-next:focus,
.fir-btn-primary:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Estados del body */
body.fir-modal-open {
    overflow: hidden;
}

/* Estilos para el checkout info */
.cursos-checkout-info {
    background: #f8f9fa !important;
    padding: 20px !important;
    margin-bottom: 20px !important;
    border-radius: 8px !important;
    border-left: 4px solid #007cba !important;
}

.cursos-checkout-info h3 {
    margin-top: 0 !important;
    color: #007cba !important;
}

.cursos-checkout-info h4 {
    margin-bottom: 10px !important;
    color: #333 !important;
}

.cursos-checkout-info p {
    margin: 5px 0 !important;
    color: #555 !important;
}

.cursos-checkout-info strong {
    color: #333 !important;
}

/* Estilos para nuevos elementos */

/* Checkbox de privacidad */
.fir-privacy-checkbox {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    display: block;
}

.fir-privacy-checkbox label {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
    width: 100%;
    color: #333 !important;
    font-weight: normal;
}

.fir-privacy-checkbox input[type="checkbox"] {
    margin: 0 !important;
    flex-shrink: 0;
    margin-top: 2px !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    min-height: 18px;
    cursor: pointer;
    appearance: checkbox;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
    border: 2px solid #007cba;
    border-radius: 3px;
    background: white;
}

.fir-privacy-checkbox input[type="checkbox"]:checked {
    background-color: #007cba;
    border-color: #007cba;
}

.fir-privacy-checkbox .fir-privacy-text {
    flex: 1;
    display: inline-block;
    line-height: 1.5;
    color: #333 !important;
    font-size: 14px;
    visibility: visible !important;
    opacity: 1 !important;
}

.fir-privacy-checkbox a {
    color: #007cba !important;
    text-decoration: underline;
    display: inline;
}

.fir-privacy-checkbox a:hover {
    color: #005a87 !important;
    text-decoration: underline;
}

/* Controles de alumnos */
.fir-alumnos-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.fir-btn-add {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.fir-btn-add:hover {
    background: #218838;
}

.fir-btn-add:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

#fir-alumnos-count {
    font-weight: 500;
    color: #495057;
}

/* Header de alumno */
.fir-alumno-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.fir-alumno-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}

.fir-alumno-number {
    background: #007cba;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.fir-btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.fir-btn-remove:hover {
    background: #c82333;
}

.fir-btn-remove:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Responsive adicional */
@media (max-width: 768px) {
    .fir-alumnos-controls {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .fir-alumno-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}