@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --secondary-light: #34d399;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --light: #ffffff;
    --dark: #1e293b;
    --gray-100: #f8fafc;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --facebook: #1877f2;
    --instagram: #e4405f;
    --whatsapp: #25d366;
    --email: #ea4335;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.1);
    --glass-bg: rgba(255, 255, 255, 0.97);
    --glass-border: rgba(255, 255, 255, 0.25);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    background: 
        linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(16, 185, 129, 0.08) 100%),
        url("../imagenes/HospitalPortada.jpg") no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    color: var(--dark);
    user-select: none;
    -webkit-user-select: none;
}

input, textarea {
    user-select: text;
    -webkit-user-select: text;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(135deg, 
            rgba(37, 99, 235, 0.15) 0%, 
            rgba(139, 92, 246, 0.05) 50%, 
            rgba(16, 185, 129, 0.1) 100%),
        url("../imagenes/HospitalPortada.jpg") no-repeat center center;
    background-size: cover;
    z-index: -1;
}

/* Efecto de lluvia */
.rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.raindrop {
    position: absolute;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 100%);
    width: 1px;
    height: 30px;
    border-radius: 0 0 8px 8px;
    opacity: 0;
    filter: blur(0.5px);
    animation: rainFall linear infinite;
}

.rain-splash {
    position: absolute;
    width: 6px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    opacity: 0;
    animation: rainSplash linear infinite;
}

@keyframes rainFall {
    0%   { transform: translateY(-100px) translateX(0); opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.6; }
    100% { transform: translateY(100vh) translateX(15px); opacity: 0; }
}

@keyframes rainSplash {
    0%   { transform: scale(0); opacity: 0; }
    50%  { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(0); opacity: 0; }
}

.login-wrapper {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 360px;
    animation: slideUp 800ms cubic-bezier(0.4, 0, 0.2, 1) both;
    margin: 0 auto;
}

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

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.login-card:hover {
    transform: translateY(-1px);
    box-shadow: 
        0 20px 40px -10px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(37, 99, 235, 0.05);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo-wrapper {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.25rem;
    position: relative;
}

.logo-square {
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 50%;
}

@keyframes neon {
    0%, 100% { 
        box-shadow: 
            0 0 5px #fff,
            0 0 10px var(--primary),
            0 0 15px var(--primary);
    }
    50% { 
        box-shadow: 
            0 0 10px #fff,
            0 0 20px var(--accent),
            0 0 30px var(--accent);
    }
}

.logo-square:hover {
    transform: scale(1.05);
}

.logo-inner {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    transition: all var(--transition-base);
    background: var(--light);
    animation: neon 1.5s ease-in-out infinite;
}

.logo-inner:hover {
    animation: none;
    box-shadow: 
        0 0 15px #fff,
        0 0 25px var(--primary),
        0 0 35px var(--primary),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.logo-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: all var(--transition-base);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    display: block;
    border-radius: 50%;
}

.logo-square:hover .logo-icon {
    transform: scale(1.05);
}

.login-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
    letter-spacing: -0.025em;
}

.login-subtitle {
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-weight: 400;
    line-height: 1.4;
}

.login-form {
    margin-bottom: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.form-label i {
    color: var(--primary);
    font-size: 0.875rem;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 1rem;
    transition: all var(--transition-fast);
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 0.75rem 0.875rem 0.75rem 2.75rem;
    background: var(--gray-100);
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    color: var(--dark);
    font-size: 0.875rem;
    font-weight: 400;
    transition: all var(--transition-fast);
    font-family: 'Inter', sans-serif;
    line-height: 1.4;
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--light);
    color: var(--dark);
    box-shadow: 
        0 0 0 3px rgba(37, 99, 235, 0.1),
        inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.form-input:focus + .input-icon {
    color: var(--primary);
    transform: translateY(-50%) scale(1.05);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 5px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
}

.password-toggle:hover {
    color: var(--primary);
    background: var(--gray-200);
    transform: translateY(-50%) scale(1.05);
}

.login-button {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 10px;
    color: var(--light);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-top: 0.375rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    font-family: 'Montserrat', sans-serif;
}

.login-button:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-1px);
    box-shadow: 
        var(--shadow-lg),
        0 0 0 1px rgba(37, 99, 235, 0.1);
}

.login-button i {
    margin-right: 0.375rem;
    font-size: 0.875rem;
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-footer {
    text-align: center;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-200);
    margin-top: 1.25rem;
}

.footer-text {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.875rem;
    font-weight: 400;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 0.875rem;
}

.social-link {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light);
    font-size: 0.875rem;
    transition: all var(--transition-base);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.social-link.facebook  { background: var(--facebook); }
.social-link.instagram { background: var(--instagram); }
.social-link.whatsapp  { background: var(--whatsapp); }
.social-link.email     { background: var(--email); }

.social-link:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: var(--shadow-sm);
}

.error-message {
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.05) 0%, 
        rgba(239, 68, 68, 0.02) 100%);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 3px solid var(--error);
    padding: 0.875rem;
    border-radius: 10px;
    margin-top: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    animation: slideIn 400ms cubic-bezier(0.4, 0, 0.2, 1) both;
    transition: opacity 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-15px); }
    to   { opacity: 1; transform: translateX(0); }
}

.error-message i {
    color: var(--error);
    font-size: 1rem;
    flex-shrink: 0;
}

.error-text {
    font-size: 0.8125rem;
    color: var(--dark);
    font-weight: 500;
    line-height: 1.3;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 2.5px solid var(--gray-200);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin-bottom: 0.875rem;
}

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

.loading-text {
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-weight: 500;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

/* RESPONSIVE */
@media (min-width: 2560px) {
    .login-wrapper { max-width: 380px; transform: scale(1.1); }
}
@media (min-width: 1200px) and (max-width: 2559px) {
    .login-wrapper { max-width: 360px; }
}
@media (min-width: 1024px) and (max-width: 1199px) {
    .login-wrapper { max-width: 340px; }
    .login-card { padding: 1.75rem; }
}
@media (min-width: 768px) and (max-width: 1023px) {
    .login-wrapper { max-width: 320px; }
    .login-card { padding: 1.5rem; }
    .login-title { font-size: 1.375rem; }
    .logo-wrapper { width: 90px; height: 90px; }
}
@media (min-width: 480px) and (max-width: 767px) {
    .login-wrapper { max-width: 340px; }
    body { padding: 1.5rem; }
    .logo-wrapper { width: 90px; height: 90px; }
}
@media (min-width: 375px) and (max-width: 479px) {
    .login-wrapper { max-width: 320px; }
    body { padding: 1rem; }
    .login-card { padding: 1.5rem; }
    .login-title { font-size: 1.25rem; }
    .logo-wrapper { width: 85px; height: 85px; margin-bottom: 1rem; }
}
@media (max-width: 374px) {
    .login-wrapper { max-width: 300px; }
    body { padding: 0.75rem; }
    .login-card { padding: 1.25rem; border-radius: 16px; }
    .login-title { font-size: 1.125rem; }
    .logo-wrapper { width: 75px; height: 75px; margin-bottom: 0.75rem; }
    .form-input { padding: 0.625rem 0.75rem 0.625rem 2.5rem; font-size: 0.8125rem; }
    .input-icon { left: 0.75rem; font-size: 0.875rem; }
    .login-button { padding: 0.75rem; font-size: 0.8125rem; }
}
@media (max-height: 600px) {
    body { align-items: flex-start; padding-top: 1rem; overflow-y: auto; }
    .login-wrapper { margin: 0.5rem auto; }
    .login-card { padding: 1.25rem; }
    .logo-wrapper { width: 70px; height: 70px; margin-bottom: 0.75rem; }
    .login-title { font-size: 1.125rem; margin-bottom: 0.125rem; }
    .form-group { margin-bottom: 1rem; }
    .login-footer { padding-top: 1rem; margin-top: 1rem; }
}
@media (max-height: 500px) {
    .login-wrapper { max-width: 300px; }
    .login-card { padding: 1rem; }
    .logo-wrapper { display: none; }
    .login-header { margin-bottom: 1rem; }
}

@media (prefers-color-scheme: dark) {
    :root {
        --glass-bg: rgba(30, 41, 59, 0.97);
        --glass-border: rgba(255, 255, 255, 0.15);
        --light: #f8fafc;
        --dark: #1e293b;
        --gray-100: #1e293b;
        --gray-200: #334155;
        --gray-300: #475569;
        --gray-400: #64748b;
        --gray-500: #94a3b8;
    }
    .login-card {
        box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05);
    }
    .login-title, .form-label, .error-text, .footer-text { color: var(--light); }
    .login-subtitle { color: var(--gray-400); }
    .form-input {
        color: var(--light);
        background: var(--gray-200);
        border-color: var(--gray-300);
    }
    .form-input:focus { background: var(--gray-100); color: var(--light); }
    @keyframes neon {
        0%, 100% { box-shadow: 0 0 5px #fff, 0 0 10px var(--primary-light), 0 0 15px var(--primary-light); }
        50% { box-shadow: 0 0 10px #fff, 0 0 20px var(--accent-light), 0 0 30px var(--accent-light); }
    }}

@supports (-webkit-touch-callout: none) {
    body { min-height: -webkit-fill-available; }
    .form-input { font-size: 16px; }
}
