/* ===================================
   Variables CSS
   =================================== */
:root {
    --primary-blue: #170A8b;
    --dark-blue: #1a237e;
    --deep-blue: #1b2668;
    --light-gray: #9ca3af;
    --text-gray: #6b7280;
    --white: #ffffff;
    --border-color: #d1d5db;
    --focus-border: #3b82f6;
    --focus-ring: rgba(59, 130, 246, 0.2);
    --transition-speed: 0.3s;
}

/* ===================================
   Reset y Base
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
}

/* ===================================
   Contenedor Principal
   =================================== */
.login-container {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Invertir orden para login */
.login-container.reverse {
    flex-direction: row-reverse;
}

/* ===================================
   Panel Izquierdo - Formulario
   =================================== */
.login-panel {
    flex: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background-color: var(--white);
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInForm 0.6s ease-out;
    min-height: 100vh;
}

/* Ocultar scrollbar pero mantener funcionalidad */
.login-panel::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.login-panel {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

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

.login-content {
    width: 100%;
    max-width: 440px;
    animation: fadeInContent 0.8s ease-out 0.2s both;
    padding: 0;
}

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

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.login-subtitle {
    font-size: 1rem;
    color: var(--light-gray);
    margin-bottom: 2rem;
    line-height: 1.4;
}

/* ===================================
   Formulario
   =================================== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    animation: fadeInUp 0.5s ease-out both;
}

.form-group:nth-child(1) { animation-delay: 0.3s; }
.form-group:nth-child(2) { animation-delay: 0.4s; }
.form-group:nth-child(3) { animation-delay: 0.5s; }
.form-group:nth-child(4) { animation-delay: 0.6s; }

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

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

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--white);
    transition: all var(--transition-speed) ease;
    outline: none;
    line-height: 1.5;
}

.form-input:focus {
    border-color: var(--focus-border);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

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

/* ===================================
   Remember & Forgot Password
   =================================== */
.form-group-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -0.25rem;
    animation: fadeInUp 0.5s ease-out 0.7s both;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.remember-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
    accent-color: var(--primary-blue);
    border-radius: 0.25rem;
}

.remember-text {
    font-size: 0.875rem;
    color: var(--text-gray);
    user-select: none;
}

.forgot-password {
    font-size: 0.875rem;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-speed) ease;
}

.forgot-password:hover {
    color: var(--dark-blue);
    text-decoration: underline;
}

/* ===================================
   Botón de Login
   =================================== */
.login-button {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    background-color: var(--primary-blue);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    margin-top: 0.5rem;
    animation: fadeInUp 0.5s ease-out 0.8s both;
    line-height: 1.5;
    min-height: 48px;
}

.login-button:hover {
    background-color: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(30, 58, 138, 0.4);
}

.login-button:active {
    transform: translateY(0);
}

/* ===================================
   Link de Registro
   =================================== */
.register-link {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-top: 0.85rem;
    animation: fadeInUp 0.5s ease-out 0.9s both;
}

.register-link a {
    color: var(--primary-blue);
    font-weight: 600;
    text-decoration: none;
    margin-left: 0.25rem;
    transition: color var(--transition-speed) ease;
}

.register-link a:hover {
    color: var(--dark-blue);
    text-decoration: underline;
}

/* ===================================
   Panel Derecho - Marca
   =================================== */
.brand-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background-color: #1b2668;
    background-image: url('/images/SistemaCotIconos/diamantesvertical.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--white);
    position: relative;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInBrand 0.6s ease-out;
    min-height: 100vh;
}

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

.brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    animation: fadeInBrand 0.8s ease-out 0.3s both;
}

@keyframes fadeInBrand {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===================================
   Logo JEMI
   =================================== */
.brand-logo {
    margin-bottom: 0;
}

.brand-logo img {
    max-width: 260px;
    width: 100%;
    height: auto;
    filter: brightness(0) invert(1);
}

/* ===================================
   Título del Sistema
   =================================== */
.brand-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    max-width: 400px;
    color: var(--white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===================================
   Decoración
   =================================== */
.brand-decoration {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 140px;
    margin-top: 0.2rem;
}

.decoration-line {
    flex: 1;
    height: 4px;
    background-color: var(--white);
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===================================
   Mensajes de Error
   =================================== */
.error-message {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #dc2626;
    font-weight: 500;
}

.status-message {
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #065f46;
    background-color: #d1fae5;
    border-radius: 0.5rem;
    border-left: 4px solid #059669;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 1024px) {
    .login-container {
        flex-direction: column;
    }

    .login-container.reverse {
        flex-direction: column;
    }

    .login-panel,
    .brand-panel {
        flex: none;
        width: 100%;
        min-height: auto;
    }

    .brand-panel {
        padding: 2.5rem 2rem;
        min-height: 35vh;
    }
    
    .login-panel {
        padding: 2.5rem 2rem;
        min-height: 65vh;
    }

    .login-title {
        font-size: 1.875rem;
    }

    .brand-title {
        font-size: 2rem;
    }

    .brand-logo img {
        max-width: 220px;
    }
}

@media (max-width: 640px) {
    .login-panel {
        padding: 2rem 1.5rem;
        min-height: auto;
    }
    
    .brand-panel {
        padding: 2rem 1.5rem;
        min-height: 30vh;
        background-size: cover;
    }

    .login-content {
        max-width: 100%;
    }

    .login-title {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
    }
    
    .login-subtitle {
        font-size: 0.9375rem;
        margin-bottom: 1.5rem;
    }

    .brand-title {
        font-size: 1.625rem;
        line-height: 1.3;
    }

    .brand-logo img {
        max-width: 180px;
    }
    
    .brand-content {
        gap: 1rem;
    }

    .form-group-inline {
        flex-direction: row;
        align-items: center;
        gap: 0;
        margin-top: 0;
    }
    
    .login-form {
        gap: 1rem;
    }
    
    .form-input {
        padding: 0.75rem 0.875rem;
        font-size: 1rem;
    }
    
    .login-button {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        margin-top: 0.5rem;
    }
    
    .form-label {
        font-size: 0.875rem;
    }
    
    .remember-text,
    .forgot-password {
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .login-panel {
        padding: 1.75rem 1.25rem;
    }
    
    .brand-panel {
        padding: 1.75rem 1.25rem;
        min-height: 28vh;
    }

    .login-title {
        font-size: 1.625rem;
        margin-bottom: 0.375rem;
    }
    
    .login-subtitle {
        font-size: 0.875rem;
        margin-bottom: 1.25rem;
    }

    .brand-logo img {
        max-width: 160px;
    }

    .brand-title {
        font-size: 1.5rem;
        max-width: 280px;
    }
    
    .brand-decoration {
        max-width: 120px;
        margin-top: 0;
    }
    
    .decoration-line {
        height: 3px;
    }
    
    .form-group {
        gap: 0.375rem;
    }
    
    .form-input {
        padding: 0.75rem 0.875rem;
        font-size: 1rem;
        border-radius: 0.375rem;
    }
    
    .login-button {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
        border-radius: 0.375rem;
        min-height: 48px;
    }
    
    .form-group-inline {
        margin-top: -0.25rem;
    }
    
    .remember-text,
    .forgot-password {
        font-size: 0.8125rem;
    }
    
    .register-link {
        font-size: 0.8125rem;
        margin-top: 1rem;
    }
}

@media (max-width: 375px) {
    .login-panel {
        padding: 1.5rem 1rem;
    }
    
    .brand-panel {
        padding: 1.5rem 1rem;
        min-height: 25vh;
    }

    .login-title {
        font-size: 1.5rem;
    }
    
    .login-subtitle {
        font-size: 0.8125rem;
    }

    .brand-logo img {
        max-width: 140px;
    }

    .brand-title {
        font-size: 1.375rem;
        max-width: 260px;
    }
    
    .form-input,
    .login-button {
        font-size: 0.9375rem;
    }
}
