/* Modern Login Design for Egresados UPCH */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');

:root {
    --primary-color: #931C44;
    /* Ruby Red */
    --primary-light: #B42354;
    --primary-dark: #7A1738;

    --secondary-color: #2c3e50;

    --accent-color: #C2986A;
    /* Gold */

    /* Solid background or subtle gradient based on Cream */
    --bg-gradient: linear-gradient(135deg, #F8EFE8 0%, #ffffff 100%);

    --card-bg: rgba(255, 255, 255, 0.95);
    --text-color: #333;
    --text-light: #666;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 15px 40px rgba(147, 28, 68, 0.2);
    /* Ruby tinted shadow */
    --radius: 12px;
    --glow-primary: 0 0 20px rgba(147, 28, 68, 0.4);
    --glow-accent: 0 0 20px rgba(194, 152, 106, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* Elimina el highlight azul en móviles */
}

/* Mejoras de rendimiento */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Mejora de touch targets para accesibilidad (mínimo 44x44px) */
button,
input,
a {
    min-height: 44px;
    min-width: 44px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(rgba(248, 239, 232, 0.7), rgba(248, 239, 232, 0.7)), url('../imagenes/egresados.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* Para iOS Safari */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* Previene scroll horizontal */
}

@keyframes float {
    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, 30px);
    }
}

.university-title {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
    pointer-events: none;
}

.university-text {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite, textGlow 3s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(147, 28, 68, 0.3);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

@keyframes textGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(147, 28, 68, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(147, 28, 68, 0.8)) drop-shadow(0 0 25px rgba(194, 152, 106, 0.5));
    }
}

.university-underline {
    margin-top: 10px;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary-color), var(--accent-color), var(--primary-color), transparent);
    border-radius: 2px;
    animation: expandLine 3s ease-in-out infinite;
    box-shadow: 0 2px 10px rgba(147, 28, 68, 0.4);
}

@keyframes expandLine {
    0%, 100% {
        width: 200px;
        opacity: 0.8;
    }
    50% {
        width: 400px;
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    position: relative;
    z-index: 10;
    animation: fadeInUp 0.8s ease-out;
    margin-top: 80px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    text-align: center;
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
    background-image: linear-gradient(var(--card-bg), var(--card-bg)), 
                      linear-gradient(135deg, var(--primary-color), var(--accent-color), var(--primary-light));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(147, 28, 68, 0.1) 0%, transparent 70%);
    animation: rotateGradient 10s linear infinite;
    pointer-events: none;
}

@keyframes rotateGradient {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.login-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-hover), var(--glow-primary);
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(147, 28, 68, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: -1;
}

.login-card:hover .card-glow {
    opacity: 1;
}

.logo-container {
    margin-bottom: 2rem;
    position: relative;
}

.logo-wrapper {
    display: inline-block;
    position: relative;
    padding: 20px;
    background: linear-gradient(135deg, rgba(147, 28, 68, 0.1), rgba(194, 152, 106, 0.1));
    border-radius: 50%;
    animation: pulseWrapper 3s ease-in-out infinite;
}

@keyframes pulseWrapper {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(147, 28, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(147, 28, 68, 0);
    }
}

.logo-container img {
    height: 100px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    animation: flipHorizontal 3s ease-in-out infinite;
    transform-origin: center center;
    position: relative;
    z-index: 1;
}

@keyframes flipHorizontal {
    0%, 100% {
        transform: scaleX(1);
    }
    50% {
        transform: scaleX(-1);
    }
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    position: relative;
    display: inline-block;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.subtitle-accent {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
    padding: 5px 15px;
    background: linear-gradient(90deg, transparent, rgba(147, 28, 68, 0.1), transparent);
    border-left: 3px solid var(--primary-color);
    border-right: 3px solid var(--accent-color);
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
    text-align: left;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

.form-group:focus-within label {
    color: var(--primary-color);
}

.label-icon {
    font-size: 1rem;
    filter: grayscale(0.3);
    transition: transform 0.3s ease, filter 0.3s ease;
}

.form-group:focus-within .label-icon {
    transform: scale(1.2);
    filter: grayscale(0);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-control:focus {
    border-color: var(--primary-color);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(147, 28, 68, 0.15), 
                0 0 15px rgba(147, 28, 68, 0.2);
    transform: translateY(-2px);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light), var(--accent-color));
    background-size: 200% 200%;
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(147, 28, 68, 0.3);
    animation: gradientMove 3s ease infinite;
}

@keyframes gradientMove {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.btn-primary:hover {
    background-position: 100% 50%;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(147, 28, 68, 0.5), var(--glow-primary);
}

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

.btn-text {
    position: relative;
    z-index: 2;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
    z-index: 1;
}

.btn-primary:hover .btn-shine {
    left: 100%;
}

.footer-text {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.6;
    position: relative;
    padding-top: 1rem;
}

.footer-accent {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--primary-color));
    border-radius: 2px;
    animation: expandAccent 2s ease-in-out infinite;
}

@keyframes expandAccent {
    0%, 100% {
        width: 60px;
    }
    50% {
        width: 100px;
    }
}

.browser-warning {
    margin-top: 30px;
    font-size: 0.75rem;
    color: #999;
    background: rgba(0, 0, 0, 0.03);
    padding: 10px;
    border-radius: 6px;
}

/* ============================================
   RESPONSIVE DESIGN - MULTIPLATAFORMA
   ============================================ */

/* Optimizaciones para touch devices */
@media (hover: none) and (pointer: coarse) {
    .btn-primary:hover {
        transform: none;
    }
    
    .login-card:hover {
        transform: none;
    }
    
    .form-control:focus {
        transform: none;
    }
}

/* Tablets y pantallas medianas (769px - 1024px) */
@media screen and (max-width: 1024px) {
    .university-text {
        font-size: 1.5rem;
        letter-spacing: 1.5px;
    }
    
    .university-underline {
        margin-top: 8px;
    }
    
    @keyframes expandLine {
        0%, 100% {
            width: 150px;
        }
        50% {
            width: 300px;
        }
    }
    
    .decorative-circle {
        opacity: 0.2;
    }
    
    .particle {
        width: 6px;
        height: 6px;
    }
}

/* Tablets pequeñas y móviles grandes (481px - 768px) */
@media screen and (max-width: 768px) {
    .university-title {
        top: 20px;
        padding: 0 20px;
    }
    
    .university-text {
        font-size: 1.2rem;
        letter-spacing: 1px;
    }
    
    @keyframes expandLine {
        0%, 100% {
            width: 120px;
        }
        50% {
            width: 250px;
        }
    }
    
    .container {
        max-width: 100%;
        padding: 15px;
        margin-top: 100px;
    }
    
    .login-card {
        padding: 30px 25px;
        border-radius: 16px;
    }
    
    .logo-container img {
        height: 80px;
    }
    
    .logo-wrapper {
        padding: 15px;
    }
    
    .login-header h1 {
        font-size: 1.3rem;
    }
    
    .subtitle-accent {
        font-size: 0.85rem;
        padding: 4px 12px;
    }
    
    .form-control {
        padding: 14px 15px;
        font-size: 16px; /* Previene zoom en iOS */
    }
    
    .btn-primary {
        padding: 14px;
        font-size: 1rem;
    }
    
    .background-shape::before {
        width: 300px;
        height: 300px;
    }
    
    .background-shape::after {
        width: 250px;
        height: 250px;
    }
    
    .decorative-circle {
        opacity: 0.15;
    }
    
    .circle-1 {
        width: 150px;
        height: 150px;
    }
    
    .circle-2 {
        width: 120px;
        height: 120px;
    }
    
    .circle-3 {
        width: 80px;
        height: 80px;
    }
    
    .particle {
        width: 5px;
        height: 5px;
    }
}

/* Móviles pequeños (hasta 480px) */
@media screen and (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .university-title {
        top: 15px;
        padding: 0 15px;
        position: relative;
        margin-bottom: 20px;
    }
    
    .university-text {
        font-size: 1rem;
        letter-spacing: 0.5px;
        line-height: 1.3;
    }
    
    @keyframes expandLine {
        0%, 100% {
            width: 100px;
        }
        50% {
            width: 200px;
        }
    }
    
    .container {
        padding: 10px;
        margin-top: 0;
    }
    
    .login-card {
        padding: 25px 20px;
        border-radius: 12px;
        border-width: 1px;
    }
    
    .logo-container {
        margin-bottom: 1.5rem;
    }
    
    .logo-container img {
        height: 70px;
    }
    
    .logo-wrapper {
        padding: 12px;
    }
    
    .login-header h1 {
        font-size: 1.2rem;
        margin-bottom: 0.3rem;
    }
    
    .subtitle-accent {
        font-size: 0.8rem;
        padding: 3px 10px;
        margin-bottom: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1.2rem;
    }
    
    .form-group label {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }
    
    .label-icon {
        font-size: 0.9rem;
    }
    
    .form-control {
        padding: 12px 14px;
        font-size: 16px; /* Previene zoom automático en iOS */
        border-width: 1.5px;
    }
    
    .btn-primary {
        padding: 13px;
        font-size: 0.95rem;
        letter-spacing: 0.3px;
    }
    
    .footer-text {
        font-size: 0.75rem;
        margin-top: 1.5rem;
        padding-top: 0.8rem;
    }
    
    .footer-accent {
        width: 50px;
        height: 2px;
    }
    
    @keyframes expandAccent {
        0%, 100% {
            width: 50px;
        }
        50% {
            width: 80px;
        }
    }
    
    .background-shape::before {
        width: 200px;
        height: 200px;
        top: -50px;
        right: -50px;
    }
    
    .background-shape::after {
        width: 150px;
        height: 150px;
        bottom: -30px;
        left: -30px;
    }
    
    .decorative-circle {
        display: none; /* Ocultar en móviles muy pequeños para mejor rendimiento */
    }
    
    .particle {
        width: 4px;
        height: 4px;
        opacity: 0.4;
    }
    
    .floating-particles {
        display: none; /* Ocultar en móviles muy pequeños para mejor rendimiento */
    }
}

/* Móviles muy pequeños (hasta 360px) */
@media screen and (max-width: 360px) {
    .university-text {
        font-size: 0.9rem;
        letter-spacing: 0.3px;
    }
    
    .login-card {
        padding: 20px 15px;
    }
    
    .logo-container img {
        height: 60px;
    }
    
    .login-header h1 {
        font-size: 1.1rem;
    }
    
    .form-control {
        padding: 11px 12px;
    }
    
    .btn-primary {
        padding: 12px;
        font-size: 0.9rem;
    }
}

/* Orientación horizontal (landscape) en móviles */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .university-title {
        top: 10px;
        position: relative;
    }
    
    .university-text {
        font-size: 0.9rem;
    }
    
    .container {
        margin-top: 10px;
    }
    
    .login-card {
        padding: 20px 25px;
    }
    
    .logo-container {
        margin-bottom: 1rem;
    }
    
    .logo-container img {
        height: 60px;
    }
    
    .login-header {
        margin-bottom: 1rem;
    }
    
    .login-header h1 {
        font-size: 1.1rem;
        margin-bottom: 0.2rem;
    }
    
    .subtitle-accent {
        font-size: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .footer-text {
        margin-top: 1rem;
        padding-top: 0.5rem;
    }
}

/* Pantallas grandes (más de 1440px) */
@media screen and (min-width: 1440px) {
    .container {
        max-width: 450px;
    }
    
    .login-card {
        padding: 50px;
    }
    
    .university-text {
        font-size: 2rem;
    }
    
    @keyframes expandLine {
        0%, 100% {
            width: 250px;
        }
        50% {
            width: 500px;
        }
    }
}

/* Pantallas muy grandes (más de 1920px) */
@media screen and (min-width: 1920px) {
    .container {
        max-width: 500px;
    }
    
    .login-card {
        padding: 60px;
    }
    
    .university-text {
        font-size: 2.2rem;
    }
}

/* Modo de alto contraste para accesibilidad */
@media (prefers-contrast: high) {
    .login-card {
        border: 3px solid var(--primary-color);
    }
    
    .form-control {
        border-width: 3px;
    }
    
    .btn-primary {
        border: 2px solid var(--primary-dark);
    }
}

/* Modo de movimiento reducido para accesibilidad */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .logo-container img {
        animation: none;
    }
    
    .gradient-text {
        animation: none;
        background: var(--primary-color);
        -webkit-text-fill-color: var(--primary-color);
    }
}

/* Clases para JavaScript */
.touch-device .btn-primary:hover,
.touch-device .login-card:hover {
    transform: none;
}

.touch-device .form-control:focus {
    transform: none;
}

.landscape .university-title {
    position: relative;
    margin-bottom: 10px;
}

.landscape .container {
    margin-top: 0;
}

/* Impresión */
@media print {
    .background-shape,
    .floating-particles,
    .decorative-elements,
    .university-title {
        display: none;
    }
    
    .login-card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Soporte para navegadores antiguos */
@supports not (backdrop-filter: blur(10px)) {
    .login-card {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* Mejoras de accesibilidad */
@media (prefers-color-scheme: dark) {
    /* Mantener colores claros incluso en modo oscuro para legibilidad */
    .login-card {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* Focus visible para accesibilidad del teclado */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}