* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f4c75 0%, #1e3a8a 25%, #2563eb 50%, #0ea5e9 75%, #06b6d4 100%);
    min-height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    padding: 20px; 
    color: #ffffff;
    position: relative;
    overflow-x: hidden;
}

/* Elementos decorativos de fondo */
body::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(14, 165, 233, 0.05) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    z-index: -1;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
}

.container { 
    max-width: 550px; 
    width: 100%; 
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(6, 182, 212, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden; 
    backdrop-filter: blur(10px);
    position: relative;
    animation: slideInUp 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #2563eb 0%, #06b6d4 50%, #2563eb 100%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.header { 
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 30%, #0ea5e9 70%, #06b6d4 100%);
    padding: 40px 30px;
    position: relative;
    text-align: left;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 30%, rgba(6, 182, 212, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(37, 99, 235, 0.2) 0%, transparent 50%);
    z-index: 1;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 2;
}

.logo-circle { 
    width: 90px; 
    height: 90px; 
    border-radius: 50%; 
    overflow: hidden; 
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    display: flex;
    justify-content: center; 
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo-circle img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.logo-fallback {
    font-size: 2.5rem;
    font-weight: 900;
    color: #2563eb;
}

.header-text .title { 
    font-size: 2.8rem; 
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    letter-spacing: -1px;
    margin: 0 0 5px 0;
}

.header-text .subtitle { 
    font-size: 1.2rem; 
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500; 
}

.form-container { 
    padding: 50px 40px; 
    display: flex; 
    flex-direction: column; 
    gap: 30px; 
    text-align: left; 
    background: rgba(255, 255, 255, 0.02);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

label { 
    font-weight: 700; 
    color: #1e40af;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.input-container {
    position: relative;
}

input { 
    width: 100%; 
    padding: 18px 20px; 
    border: 2px solid #e2e8f0;
    border-radius: 12px; 
    font-size: 1.1rem;
    background: #ffffff;
    color: #1e40af;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

input:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 
        0 0 0 4px rgba(6, 182, 212, 0.1),
        0 8px 25px rgba(6, 182, 212, 0.15);
    transform: translateY(-2px);
    background: #ffffff;
}

input:focus + .input-icon {
    color: #06b6d4;
    transform: scale(1.1);
}

.input-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toggle-password {
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
}

.toggle-password:hover {
    color: #06b6d4;
    transform: translateY(-50%) scale(1.1);
}

button { 
    width: 100%; 
    padding: 20px; 
    border: 0; 
    border-radius: 16px; 
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 50%, #06b6d4 100%);
    color: #ffffff; 
    font-weight: 700; 
    font-size: 1.2rem; 
    cursor: pointer; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 15px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

button:hover::before {
    left: 100%;
}

button:hover { 
    background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 50%, #0891b2 100%);
    transform: translateY(-3px) scale(1.02); 
    box-shadow: 
        0 20px 40px rgba(37, 99, 235, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

button:active {
    transform: translateY(-1px) scale(1.01);
}

.err { 
    color: #dc2626; 
    font-weight: 600; 
    padding: 16px 20px;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-radius: 12px;
    text-align: center;
    border: 2px solid #fca5a5;
    margin-bottom: 10px;
    animation: shake 0.5s ease-in-out;
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.1);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.back-link { 
    display: block; 
    text-align: center; 
    margin: 25px 30px 35px;
    text-decoration: none; 
    font-weight: 700; 
    padding: 18px 25px;
    border-radius: 16px; 
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.back-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

.back-link:hover::before {
    left: 100%;
}

.back-link:hover { 
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 15px 35px rgba(16, 185, 129, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

.back-link:active {
    transform: translateY(-1px) scale(1.01);
}

.teacher-badge {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.teacher-badge {
    font-size: 0.8rem;
    padding: 3px 10px;
}

/* Gear icon for admin login */
.admin-gear {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.admin-gear:hover {
    color: #06b6d4;
    transform: rotate(90deg) scale(1.1);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideInUp 0.5s ease;
}

.close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    color: #374151;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #dc2626;
}

.modal-content h2 {
    color: #1e40af;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(50px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Animación de entrada para elementos del formulario */
.form-group {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.form-group:nth-child(1) { animation-delay: 0.2s; }
.form-group:nth-child(2) { animation-delay: 0.4s; }
.form-group:nth-child(3) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsividad */
@media (max-width: 768px) {
    body { padding: 15px; }
    .container { border-radius: 20px; max-width: 95%; }
    .header { padding: 35px 25px; }
    .header-content { gap: 18px; }
    .logo-circle { width: 80px; height: 80px; }
    .header-text .title { font-size: 2.4rem; }
    .header-text .subtitle { font-size: 1.1rem; }
    .form-container { padding: 40px 30px; gap: 25px; }
    input { padding: 16px 18px; font-size: 1rem; }
    button { padding: 18px; font-size: 1.1rem; }
    .back-link { margin: 20px 25px 30px; padding: 16px 20px; font-size: 1rem; }
    .admin-gear { font-size: 1.8rem; top: 15px; right: 15px; }
}

@media (max-width: 480px) {
    .container { border-radius: 18px; }
    .header { padding: 30px 20px; }
    .header-content { flex-direction: column; text-align: center; gap: 15px; }
    .logo-circle { width: 70px; height: 70px; }
    .header-text .title { font-size: 2.2rem; }
    .header-text .subtitle { font-size: 1rem; }
    .form-container { padding: 30px 20px; gap: 20px; }
    input { padding: 15px 16px; }
    button { padding: 16px; font-size: 1rem; }
    .back-link { margin: 18px 20px 25px; padding: 15px 18px; }
    .modal-content { padding: 20px; }
}