/* === Modern and Responsive Enhancements for Registration Page === */
/* Simple CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape on iOS */
}

body {
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
}

h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

:root {
    --primary-color: #ff6471;
    --secondary-color: #e3cc7a;
    --dark-color: #333;
    --light-color: #f4f4f4;
    --font-family: 'Open Sans', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body.registration-page {
    background-color: var(--light-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    font-family: var(--font-family);
    /* Tamaño de fuente base fluido con mínimo mayor para legibilidad */
    font-size: clamp(18px, 3vw, 20px);
}

.registration-container {
    background: #ffffff;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 500px;
    min-width: 360px; /* evita tarjeta demasiado pequeña en móviles comunes */
    text-align: left;
}

.registration-container h1 {
    color: var(--dark-color);
    margin-bottom: 20px;
    /* Título más notorio en móviles y tablets */
    font-size: clamp(2rem, 5.5vw, 2.4rem);
    text-align: center;
}

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

.registration-container .form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    /* Aumenta legibilidad de etiquetas */
    font-size: clamp(1.1rem, 3vw, 1.25rem);
    /* Mantiene una base visual estable dentro del contenedor */
    min-width: 280px;
    max-width: 100%;
}

.registration-container .form-control {
    width: 100%;
    padding: 12px 15px;
    /* Mínimo mayor para campos de entrada */
    font-size: clamp(18px, 2.8vw, 20px);
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    /* Evita que el input quede demasiado estrecho dentro de la tarjeta */
    min-width: 280px;
}

.registration-container .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 100, 113, 0.2);
    outline: none;
}

.btn-submit {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: clamp(17px, 2.6vw, 19px);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    min-width: 280px;
}

.btn-submit:hover {
    background-color: #e05561;
    transform: translateY(-2px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-block;
    width: auto;
    padding: 15px 30px;
    background-color: var(--secondary-color);
    color: #000;
    border: none;
    border-radius: 4px;
    font-size: clamp(17px, 2.6vw, 19px);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    text-align: center;
    min-width: 280px;
}

.btn-secondary:hover {
    background-color: #c7b26b;
    transform: translateY(-2px);
}

.modal-footer .btn-tertiary {
    padding: 10px 20px;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-footer .btn-tertiary:hover {
    background-color: #e0e0e0;
}

.registration-container .terms {
    margin-top: 20px;
    font-size: clamp(1.1rem, 2.6vw, 1.2rem);
    color: #777;
    text-align: center;
}

.registration-container .terms a {
    color: var(--primary-color);
    text-decoration: none;
}

.registration-container .terms a:hover {
    text-decoration: underline;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto;
    background: rgba(0,0,0,0.5);
}
.modal.show {
    display: block;
}
.modal-dialog {
    margin: 5% auto;
    max-width: 600px;
}
.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    position: relative;
}
.modal-body {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .registration-container {
        padding: 30px;
        margin: 0;
    }

    .registration-container h1 {
        font-size: 1.8em;
    }
}

@media (max-width: 380px) {
    /* En pantallas muy pequeñas, permitir que la tarjeta se adapte al 100% */
    .registration-container {
        min-width: auto;
        padding: 20px;
    }

    /* Restablece min-width para evitar overflow horizontal */
    .registration-container .form-control,
    .registration-container .form-group label,
    .btn-submit,
    .btn-secondary {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    body.registration-page {
        padding: 10px;
    }

    .registration-container {
        padding: 20px;
    }

    .registration-container h1 {
        font-size: 1.6em;
    }

    .registration-container .form-group label {
        font-size: 0.95em;
    }

    .registration-container .form-control {
        padding: 12px;
        font-size: 1em;
    }

    .btn-submit, .btn-secondary {
        padding: 12px 20px;
        font-size: 1em;
    }
}

/* Utility Classes used in the form */
.d-none { display: none !important; }
.text-center { text-align: center !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.img-fluid { max-width: 100%; height: auto; }
.rounded { border-radius: 0.25rem !important; }
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-left: 0; /* elimina offset tipo Bootstrap */
}
.form-check-input {
    position: relative; /* evita posicionamiento absoluto que desalineaba */
    margin: 0.2rem 0 0; /* alinea con la primera línea del texto */
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    cursor: pointer;
    accent-color: var(--primary-color); /* color del check soportado por navegadores modernos */
    border: 1px solid #aaa;
    border-radius: 4px;
}
.form-check-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 100, 113, 0.25);
}
.form-check-label {
    margin: 0;
    color: #555;
    font-size: clamp(1rem, 2.6vw, 1.1rem);
    line-height: 1.4;
    cursor: pointer; /* permite click en el texto */
}
.form-check-label a { color: var(--primary-color); text-decoration: underline; }
.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.modal-lg { max-width: 800px; }
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: calc(0.3rem - 1px);
    border-top-right-radius: calc(0.3rem - 1px);
}
.modal-title { margin-bottom: 0; line-height: 1.5; }
.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em 0.25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: 0;
    border-radius: 0.25rem;
    opacity: .5;
}
.modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(0.3rem - 1px);
    border-bottom-left-radius: calc(0.3rem - 1px);
}
.terms-content {
    line-height: 1.6;
    color: #333;
    font-size: clamp(0.95rem, 2.2vw, 1.05rem);
}
.terms-content p { margin: 0 0 0.75rem; }
.terms-content h6 {
    margin: 1rem 0 0.5rem;
    font-size: clamp(1rem, 2.4vw, 1.1rem);
    color: #111;
}
.terms-content ul { margin: 0 0 0.75rem 1.2rem; }
.terms-content li { margin-bottom: 0.4rem; }
.terms-content a { color: var(--primary-color); text-decoration: underline; }
.terms-content .indent { text-indent: 1.5em; }
.error-message {
            color: red;
            font-size: 0.875em;
            margin-top: 5px;
}
.field-hint {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 6px;
}

/* Global Loader Overlay */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.loader-overlay .spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    padding: 20px 24px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
}
.spinner-circle {
    width: 42px;
    height: 42px;
    border: 4px solid #eee;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
.spinner-text { color: #444; font-weight: 600; }

@keyframes spin {
    to { transform: rotate(360deg); }
}
