* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Header formal */
header {
    background: linear-gradient(135deg, #1a237e, #283593);
    color: white;
    padding: 40px 30px;
    text-align: center;
    border-bottom: 4px solid #3949ab;
}

header h1 {
    font-size: 2.8em;
    margin-bottom: 20px;
    font-weight: 300;
    letter-spacing: 1px;
}

.info-colegio {
    background: rgba(255,255,255,0.1);
    padding: 25px;
    border-radius: 8px;
    margin-top: 20px;
    backdrop-filter: blur(10px);
}

.info-colegio h2 {
    margin-bottom: 15px;
    color: #e3f2fd;
    font-size: 1.8em;
    font-weight: 400;
}

.info-colegio p {
    margin-bottom: 8px;
    font-size: 1.1em;
}

.destacado {
    background: #ff9800;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    font-weight: 600;
    border-left: 4px solid #ff5722;
}

/* Main content */
main {
    padding: 40px;
}

/* Fieldset styling */
fieldset {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    background: #fafafa;
    transition: border-color 0.3s ease;
}

fieldset:hover {
    border-color: #5c6bc0;
}

legend {
    font-size: 1.4em;
    font-weight: 500;
    color: #3949ab;
    padding: 0 20px;
    background: white;
    border-radius: 25px;
    border: 2px solid #3949ab;
}

.motivos-section {
    border-color: #5c6bc0;
}

.motivos-section legend {
    color: #5c6bc0;
    border-color: #5c6bc0;
}

/* Form groups */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #37474f;
    font-size: 1.1em;
}

.motivo-title {
    font-size: 1.3em;
    color: #3949ab;
    margin-bottom: 20px !important;
    font-weight: 600;
}

/* Motivos grid - CORREGIDO */
.motivos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.motivo-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.motivo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(57, 73, 171, 0.1), transparent);
    transition: left 0.5s;
}

.motivo-card:hover::before {
    left: 100%;
}

.motivo-card:hover {
    border-color: #5c6bc0;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* Checkbox oculto pero funcional */
.motivo-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.motivo-card label {
    cursor: pointer;
    margin-bottom: 0;
    display: block;
}

.motivo-card strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.15em;
    font-weight: 600;
}

.motivo-card span {
    display: block;
    color: #546e7a;
    font-size: 0.95em;
    font-weight: 400;
    line-height: 1.5;
}

/* Estado seleccionado - CORREGIDO */
.motivo-card.selected {
    border-color: #4caf50;
    background: linear-gradient(135deg, #f1f8e9, #e8f5e8);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.2);
}

.motivo-card.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 15px;
    background: #4caf50;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Input fields */
input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3949ab;
    box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.1);
    background: #fafafa;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Botones formales */
.form-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 40px 0 20px 0;
}

.btn {
    padding: 16px 35px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, #3949ab, #5c6bc0);
    color: white;
    box-shadow: 0 4px 15px rgba(57, 73, 171, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #303f9f, #3949ab);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(57, 73, 171, 0.4);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #78909c, #90a4ae);
    color: white;
    box-shadow: 0 4px 15px rgba(120, 144, 156, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #607d8b, #78909c);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120, 144, 156, 0.4);
}

/* Mensajes */
.mensaje {
    padding: 25px;
    border-radius: 10px;
    margin: 30px 0;
    text-align: center;
    font-weight: 600;
    font-size: 1.1em;
    line-height: 1.6;
}

.mensaje.exito {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    color: #2e7d32;
    border: 2px solid #4caf50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

.mensaje.error {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    color: #c62828;
    border: 2px solid #f44336;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.2);
}

/* Información legal */
.info-legal {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    padding: 30px;
    border-radius: 10px;
    border-left: 6px solid #2196f3;
    margin-top: 40px;
}

.info-legal h3 {
    color: #1565c0;
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 600;
}

.info-legal ul {
    list-style: none;
}

.info-legal li {
    margin-bottom: 15px;
    padding-left: 35px;
    position: relative;
    font-size: 1.05em;
    line-height: 1.5;
}

.info-legal li:before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    background: #2196f3;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #263238, #37474f);
    color: white;
    text-align: center;
    padding: 25px;
    margin-top: 40px;
    font-size: 1em;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 8px;
    }
    
    main {
        padding: 25px;
    }
    
    header {
        padding: 30px 20px;
    }
    
    header h1 {
        font-size: 2.2em;
    }
    
    .motivos-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    fieldset {
        padding: 20px;
    }
    
    .motivo-card {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    main {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .info-colegio {
        padding: 15px;
    }
    
    .form-actions {
        gap: 15px;
    }
    
    .btn {
        padding: 14px 25px;
        font-size: 14px;
    }
}

/* Estados de validación */
input:valid, select:valid, textarea:valid {
    border-color: #4caf50;
}

input:invalid:not(:focus):not(:placeholder-shown),
select:invalid:not(:focus),
textarea:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #f44336;
    background: #ffebee;
}

/* Loading state */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}