/* =============================================
   SISGESTION v2 - Login Page Styles
   Split-screen: left branding + right form
   ============================================= */

:root {
    --sg-blue:        #00609f;
    --sg-blue-dark:   #004a7c;
    --sg-blue-darker: #002e50;
    --sg-blue-light:  #0078c2;
    --sg-gray-bg:     #f4f6f9;
    --sg-border:      #dee2e6;
    --sg-text:        #212529;
    --sg-muted:       #6c757d;
    --sg-radius:      8px;
    --sg-shadow:      0 4px 24px rgba(0,0,0,0.10);
}

/* =============================================
   Reset base
   ============================================= */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: "Nunito Sans", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    color: var(--sg-text);
    background: #0a1628;
    overflow-x: hidden;
}

/* =============================================
   Page structure - Split screen
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0a1628;
    position: relative;
}

/* Hide the top bar - not needed in split layout */
.login-topbar {
    display: none;
}

/* =============================================
   Main content - Split layout
   ============================================= */
.login-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    position: relative;
    z-index: 1;
}

/* =============================================
   LEFT PANEL - Branding area
   ============================================= */
/* Velo sobre la foto: aclara el borde superior (logo DNP) y oscurece levemente la base */
.login-branding::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.50) 0%, rgba(255,255,255,0.0) 18%, rgba(8,20,38,0.0) 72%, rgba(8,20,38,0.22) 100%);
    z-index: 1;
    pointer-events: none;
}

/* Foto de fondo: ocupa exactamente el panel izquierdo (no la página), de modo que
   el recorte de object-fit se calcula sobre el área visible real. El foco (torre DNP
   y bandera) está al ~25% horizontal y la marca DNP arriba: se ancla arriba para no cortar el letrero. */
.login-branding > img.login-bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 25% top;
    display: block;
    z-index: 0;
    pointer-events: none;
}

/* Left panel - Edificio Fonade + DNP identity */
.login-branding {
    width: 60%;
    flex: 1 1 60%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    z-index: 2;
    padding: 2.25rem 2.75rem;
    text-align: left;
}

/* Emblema DNP en la esquina superior derecha de la foto (sobre el cielo, lejos del árbol) */
.login-brand-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 1rem;
}

.login-brand-dnp {
    height: 62px;
    object-fit: contain;
    filter: drop-shadow(0 2px 10px rgba(255,255,255,0.5));
}

.login-brand-slogan {
    color: #0b2f53;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.15;
    text-align: right;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 12px rgba(255,255,255,0.7);
}

.login-brand-location {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    color: #fff;
    font-size: 0.82rem;
    line-height: 1.5;
    text-shadow: 0 1px 8px rgba(0,0,0,0.75);
    max-width: 340px;
}

.login-brand-location .bi {
    font-size: 1.15rem;
    line-height: 1.3;
}

.login-brand-location strong {
    font-weight: 700;
    font-size: 0.92rem;
}

/* =============================================
   RIGHT PANEL - Form area
   ============================================= */
.login-right {
    width: 40%;
    min-width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #edf1f7 0%, #e4e9f0 100%);
    position: relative;
    z-index: 2;
    padding: 2rem;
    border-left: 1px solid rgba(0,0,0,0.08);
}

/* =============================================
   Login card
   ============================================= */
/* El asp:Panel se renderiza como div y es el flex-item de .login-right;
   sin width:100% se encoge al contenido y la tarjeta nunca alcanza su max-width. */
.login-panel-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 640px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    padding: 3rem 3.5rem 2.5rem;
    border: 1px solid rgba(0,0,0,0.1);
}

/* SISGESTION logo above title */
.login-card-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1.75rem;
}

.login-card-logo {
    height: 88px;
    object-fit: contain;
    max-width: 100%;
}

.login-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sg-text);
    margin-bottom: 0.3rem;
    line-height: 1.2;
    text-align: center;
    letter-spacing: -0.01em;
}

.login-card-subtitle {
    font-size: 0.95rem;
    color: var(--sg-muted);
    margin-bottom: 2rem;
    text-align: center;
}

/* =============================================
   Form fields
   ============================================= */
.login-field-group {
    margin-bottom: 1.1rem;
}

.login-field-group .input-group {
    border-radius: var(--sg-radius);
    overflow: hidden;
    box-shadow: none;
    transition: box-shadow 0.2s;
}

.login-field-group .input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(0,96,159,0.15);
}

.login-input-icon {
    background: #f0f2f5;
    border-color: #e0e3e7;
    color: #8b939c;
    font-size: 1.05rem;
    border-right: none;
    border-radius: var(--sg-radius) 0 0 var(--sg-radius) !important;
    min-width: 54px;
    justify-content: center;
}

.login-field-group .form-floating {
    flex: 1;
}

/* Alto/padding los define .form-floating de Bootstrap (3.5rem); aqui solo color y tipografia. */
.login-input-right,
.login-input-mid {
    border-color: #e0e3e7;
    border-left: none;
    font-size: 1rem;
    color: var(--sg-text);
    background: #f8f9fb;
    transition: border-color 0.15s, background 0.15s;
}

.login-input-right,
.login-input-mid {
    border-radius: 0 var(--sg-radius) var(--sg-radius) 0 !important;
}

/* Cuando el ojito está visible, el input cede el borde derecho al botón */
.input-group.has-toggle .login-input-mid {
    border-radius: 0 !important;
    border-right: none;
}

.login-input-right:focus,
.login-input-mid:focus {
    border-color: var(--sg-blue);
    box-shadow: none;
    background: #fff;
}

.login-field-group .form-floating label {
    font-size: 0.95rem;
    color: #8b939c;
    left: 0;
}

/* Botón mostrar/ocultar contraseña */
.login-toggle-pwd {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    border: 1px solid #e0e3e7;
    border-left: none;
    border-radius: 0 var(--sg-radius) var(--sg-radius) 0;
    background: #f8f9fb;
    color: #8b939c;
    font-size: 1.05rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.login-toggle-pwd:hover {
    color: var(--sg-blue);
    background: #f0f2f5;
}

.login-field-group .input-group:focus-within .login-toggle-pwd {
    border-color: var(--sg-blue);
    background: #fff;
}

/* Vigencia + tipo login selects */
.login-select-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.1rem;
}

.login-select-row .select-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    min-width: 70px;
}

.login-select-row select.form-select {
    flex: 1;
    height: 48px;
    border-radius: var(--sg-radius);
    border-color: #e0e3e7;
    font-size: 0.95rem;
    color: var(--sg-text);
    background-color: #f8f9fb;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.login-select-row select.form-select:focus {
    border-color: var(--sg-blue);
    box-shadow: 0 0 0 3px rgba(0,96,159,0.12);
    background-color: #fff;
}

/* Checkbox - cambiar usuario */
span.form-check-input,
.form-check span.form-check-input {
    all: unset !important;
    display: inline !important;
}

.login-check-row input[type="checkbox"] {
    width: 1.1em;
    height: 1.1em;
    margin-top: 0.1em;
    vertical-align: middle;
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    border: 1.5px solid #c5cad0;
    border-radius: 0.2em;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.login-check-row input[type="checkbox"]:checked {
    background-color: var(--sg-blue);
    border-color: var(--sg-blue);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.login-check-row input[type="checkbox"]:focus {
    border-color: var(--sg-blue);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,96,159,0.2);
}

.login-check-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1.35rem;
    margin-top: -0.15rem;
}

.login-check-row .form-check-label {
    font-size: 0.9rem;
    color: var(--sg-muted);
    cursor: pointer;
    vertical-align: middle;
    margin-left: 0.3em;
}

/* Error */
.login-error-wrap {
    min-height: 1rem;
    margin-bottom: 0.5rem;
}

.login-error-wrap .login-lbl-error {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #dc3545;
    text-align: center;
    line-height: 1.4;
}

.login-error-wrap .login-lbl-error:empty {
    display: none;
}

/* =============================================
   Buttons
   ============================================= */
.btn-sg-primary {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, var(--sg-blue) 0%, var(--sg-blue-dark) 100%);
    border: none;
    border-radius: var(--sg-radius);
    color: white !important;
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0.95rem 1.5rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,96,159,0.25);
}

.btn-sg-primary:hover {
    background: linear-gradient(135deg, var(--sg-blue-dark) 0%, var(--sg-blue-darker) 100%);
    box-shadow: 0 4px 16px rgba(0,96,159,0.35);
    transform: translateY(-1px);
    color: white !important;
}

.btn-sg-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,96,159,0.2);
}

.login-action-links {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.35rem;
    gap: 1.5rem;
}

.login-action-links a,
.login-action-links .sg-link-btn {
    font-size: 0.88rem;
    color: var(--sg-blue);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s;
}

.login-action-links a:hover,
.login-action-links .sg-link-btn:hover {
    color: var(--sg-blue-dark);
    text-decoration: underline;
}

/* Version label */
.login-version {
    text-align: center;
    margin-top: 1.35rem;
    font-size: 0.78rem;
    color: #c0c5cc;
    letter-spacing: 0.5px;
}

/* =============================================
   Questions panel (preguntas de seguridad)
   ============================================= */
.questions-panel {
    width: 100%;
    max-width: 700px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.08);
    padding: 2rem;
}

.questions-panel .questions-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sg-blue-darker);
    margin-bottom: 0.25rem;
}

.questions-panel .questions-subtitle {
    font-size: 0.85rem;
    color: var(--sg-muted);
    margin-bottom: 1.5rem;
}

.questions-panel .table thead th {
    background: var(--sg-blue);
    color: white;
    font-size: 0.83rem;
    font-weight: 600;
    border-color: var(--sg-blue-dark);
    padding: 0.65rem 0.75rem;
}

.questions-panel .table tbody td {
    font-size: 0.875rem;
    vertical-align: middle;
    padding: 0.65rem 0.75rem;
    border-color: #e9ecef;
}

.questions-panel .table tbody tr:hover {
    background: #f8f9ff;
}

.questions-panel .table select,
.questions-panel .table textarea {
    font-size: 0.85rem;
    border-radius: 6px;
    border-color: var(--sg-border);
    width: 100%;
    padding: 0.35rem 0.5rem;
}

.questions-panel .table textarea {
    resize: vertical;
    min-height: 60px;
}

.questions-panel .table select:focus,
.questions-panel .table textarea:focus {
    border-color: var(--sg-blue);
    box-shadow: 0 0 0 3px rgba(0,96,159,0.15);
    outline: none;
}

/* =============================================
   Footer
   ============================================= */
.login-footer {
    background: #1a2332;
    color: rgba(255,255,255,0.6);
    font-size: 0.68rem;
    padding: 0.65rem 2.5rem;
    display: flex;
    gap: 2rem;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.login-footer-col {
    flex: 1;
}

.login-footer-col p {
    margin: 0.08rem 0;
    line-height: 1.5;
}

.login-footer-col a {
    color: rgba(255,255,255,0.75);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.login-footer-col a:hover {
    color: white;
}

.login-footer-col.text-end { text-align: right; }

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 991.98px) {
    .login-main {
        flex-direction: column;
    }

    /* Franja superior con la proporción de la foto (1400x781): se ve completa sin
       recortar la torre; max-height evita que domine en tablets horizontales. */
    .login-branding {
        width: 100%;
        flex: 0 0 auto;
        padding: 2rem 1.5rem;
        aspect-ratio: 1400 / 781;
        min-height: 200px;
        max-height: 45vh;
    }

    .login-branding-logo {
        height: 64px;
        margin-bottom: 1rem;
    }

    .login-branding-subtitle {
        font-size: 0.92rem;
        margin-bottom: 1.5rem;
    }

    .login-right {
        width: 100%;
        min-width: auto;
        padding: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .login-card {
        padding: 1.75rem 1.5rem 1.5rem;
        border-radius: 12px;
    }

    .login-card-title { font-size: 1.2rem; }

    .login-branding {
        padding: 1.5rem 1rem;
        min-height: 180px;
    }

    .login-brand-dnp { height: 46px; }

    .login-branding-logo { height: 52px; }

    .login-branding-badge { font-size: 0.68rem; padding: 0.5rem 1.2rem; }

    .login-footer {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.65rem 1.25rem;
    }

    .login-footer-col.text-end { text-align: left; }
}
