/* /app/css/auth-forms.css (Versión Final, COMPLETA Y UNIFICADA) */

:root {
    --primary-color: #3498db;
    --secondary-color: #f39c12;
    --background-color: #ecf0f1;
    --text-color: #34495e;
    --card-bg: #ffffff;
    --input-bg: #f0f5fa;
    --error-bg: #e74c3c;
    --success-bg: #2ecc71;
    --font-family: 'Nunito', sans-serif;
}

/* --- ESTILOS GENERALES Y LAYOUT --- */
body {
    margin: 0; font-family: var(--font-family); background-color: var(--background-color);
    color: var(--text-color); display: flex; justify-content: center; align-items: center;
    min-height: 100vh; padding: 20px; box-sizing: border-box;
}

.main-container {
    width: 100%; max-width: 900px; background-color: var(--card-bg);
    border-radius: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 30px 40px; overflow: hidden;
}

.main-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.logo { height: 50px; }

.step { display: none; animation: fadeIn 0.5s ease-in-out; }
.step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

h1, h2 { text-align: center; color: var(--primary-color); font-weight: 900; }

.error-banner, .success-banner {
    background-color: var(--error-bg); color: white; padding: 15px; text-align: center;
    border-radius: 8px; margin-bottom: 20px; font-weight: 700;
}
.success-banner { background-color: var(--success-bg); }

/* --- SELECCIÓN DE ROL (acceso.php) --- */
.role-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 25px; margin-top: 40px;
}
.role-card {
    background: #ffffff; border-radius: 15px; padding: 20px; text-align: center;
    cursor: pointer; transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.role-card:hover { transform: translateY(-10px); box-shadow: 0 10px 25px rgba(0,0,0,0.12); }
.role-card img { height: 80px; margin-bottom: 15px; }
.role-card span { font-size: 1.2em; font-weight: 700; display: block; }
/* --- .role-card.special-guest { background: #e8f4fd; }  --- */
.role-card.special-guest { background: #ffffff; }

/* --- FORMULARIOS DE AUTENTICACIÓN (Comunes) --- */
.form-container { max-width: 450px; margin: 0 auto; }
.auth-form { display: none; } /* Para el antiguo sistema de login/registro en la misma vista */
.auth-form.active { display: block; }

.back-btn {
    background: none; border: 2px solid #ccc; color: #888; border-radius: 50px;
    padding: 5px 15px; font-weight: 700; cursor: pointer; margin-bottom: 20px; transition: all 0.3s;
}
.back-btn:hover { background-color: #ddd; color: var(--text-color); }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; text-align: left; font-weight: 700; margin-bottom: 8px; color: #555; }
.form-group input, .form-group select {
    width: 100%; padding: 12px 15px; border: 1px solid #ccc; border-radius: 8px;
    font-size: 1em; box-sizing: border-box; background-color: var(--input-bg);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--primary-color); box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); outline: none;
}
.form-group select:disabled { background-color: #e9ecef; cursor: not-allowed; }

button[type="submit"] {
    width: 100%; padding: 12px; margin-top: 20px; border: none; border-radius: 10px;
    background-color: var(--secondary-color); color: white; font-size: 1.1em;
    font-weight: 700; cursor: pointer; transition: background-color 0.3s;
}
button[type="submit"]:hover { background-color: #d8890b; }

.form-container p { text-align: center; margin-top: 15px; font-size: 0.9em; }
.form-container a { color: var(--primary-color); text-decoration: none; font-weight: 700; }
.form-container a:hover { text-decoration: underline; }

/* --- FORMULARIOS DE REGISTRO (Padres y Profesores) --- */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; gap: 0; } }

.students-section h3 { border-top: 1px solid #eee; padding-top: 20px; margin-top: 30px; }
.student-block { background: #f8f9fa; border: 1px solid #e9ecef; padding: 20px; border-radius: 10px; margin-bottom: 15px; position: relative; }
.remove-student-btn { position: absolute; top: 5px; right: 5px; background: none; border: none; font-size: 1.5em; line-height: 1; cursor: pointer; color: #ccc; padding: 5px; }
.remove-student-btn:hover { color: var(--error-bg); }
#add-student-btn { display: block; width: 100%; padding: 10px; margin-top: 10px; font-weight: 700; border: 2px dashed var(--primary-color); background: #e8f4fd; color: var(--primary-color); border-radius: 10px; cursor: pointer; transition: all 0.2s; }
#add-student-btn:hover { background: #d6eaf8; }
#add-student-btn:disabled { background: #eee; color: #aaa; border-color: #ddd; cursor: not-allowed; }

.form-group-checkbox { display: flex; align-items: flex-start; gap: 10px; margin-top: 20px; }
.form-group-checkbox input { width: auto; margin-top: 5px; flex-shrink: 0; }
.form-group-checkbox label { margin: 0; font-weight: normal; font-size: 0.9em; line-height: 1.5; }
.form-group-checkbox a { cursor: pointer; }

/* --- ELEMENTOS DE FORMULARIOS ESPECÍFICOS (Invitado, Registro Alumno antiguo) --- */
.year-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px; margin: 20px 0;
}
.year-btn {
    padding: 10px; border: 2px solid #ddd; border-radius: 8px; cursor: pointer;
    text-align: center; transition: all 0.2s; font-weight: 700;
}
.year-btn input[type="radio"] { display: none; }
.year-btn.selected, .year-btn:hover {
    background-color: var(--primary-color); color: white; border-color: var(--primary-color);
    transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.avatar-preview-container { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; background-color: #f8f9fa; padding: 10px; border-radius: 10px; }
.avatar-preview-container label { margin: 0; font-weight: 700; }
#avatar-preview { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 3px solid #ddd; }
#open-avatar-popup { background-color: #555; color: white; border: none; padding: 8px 15px; border-radius: 8px; cursor: pointer; }

/* --- POPUP (Avatares, Modal Legal) --- */
.popup, .modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center;
}
.popup.show, .modal-overlay[style*="display: flex"] { display: flex; } /* Unificar cómo se muestran */

.popup-content, .modal-content {
    background: white; padding: 30px; border-radius: 15px; text-align: center;
    width: 90%; max-width: 800px; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: popup-appear 0.3s ease-out; position: relative;
    max-height: 90vh; overflow-y: auto;
}
@keyframes popup-appear { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.popup-content h3, .modal-body h1, .modal-body h3 { margin-top: 0; color: var(--primary-color); }
.popup-close, .modal-close {
    position: absolute; top: 10px; right: 20px; font-size: 2.5em; line-height: 1;
    cursor: pointer; color: #aaa; font-weight: 300; transition: color 0.2s; border: none; background: none;
}
.popup-close:hover, .modal-close:hover { color: #333; }

.avatar-selection {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px; margin: 20px 0; max-height: 300px; overflow-y: auto; padding: 5px;
}
.avatar-option { width: 100px; height: 100px; border-radius: 50%; overflow: hidden; cursor: pointer; border: 4px solid transparent; transition: all 0.2s; display: block; position: relative; margin: auto; }
.avatar-option input { display: none; }
.avatar-option img { width: 100%; height: 100%; object-fit: cover; }
.avatar-option.selected { border-color: var(--secondary-color); transform: scale(1.1); }
/* ====================================================== */
/* --- ESTILOS PARA EL SELECTOR DE AVATAR (CORREGIDO) --- */
/* ====================================================== */

.avatar-preview-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #ddd;
}

.avatar-preview-container label {
    margin: 0;
    font-weight: 700;
    color: #555;
}

.avatar-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ddd;
}

.open-avatar-popup {
    background-color: #555;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-family: var(--font-family);
}


.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
    /* Hacemos que el input ocupe todo el ancho del contenedor */
    width: 100%;
    /* Añadimos un poco de padding a la derecha para que el texto no se solape con el botón */
    padding-right: 40px !important;
}

.toggle-password {
    position: absolute;
    right: 1px; /* Posicionamos el botón a la derecha */
    top: 1px;
    bottom: 1px;
    width: 38px; /* Ancho fijo para el botón */
    
    /* Estilos para que parezca un icono y no un botón */
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: #888;
    
    /* Centramos el icono del ojo */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    
    transition: color 0.2s;
}

.toggle-password:hover {
    color: var(--primary-color);
}



#moreAvatarsBtn { background-color: var(--secondary-color); color: white; padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-weight: bold; margin: 5px; }

/* --- PÁGINA DE ÉXITO --- */
.success-box { text-align: center; line-height: 1.6; }
.success-box .icon { font-size: 4em; color: var(--success-bg); }
.success-box .child-info { background-color: #f0f5fa; padding: 15px; border-radius: 10px; margin-top: 20px; border: 2px dashed var(--primary-color); }
.success-box .parent-info { background-color: #fff8e1; padding: 15px; border-radius: 10px; margin-top: 20px; border: 2px dashed var(--secondary-color); }