/* Global Body & Layout Styles */
html,
body {
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #faf9f6 !important;
    /* Soft Ivory background */
    font-family: 'Montserrat', sans-serif;
    color: #1a1a1a;
    /* Executive dark text */
    overflow: hidden !important;
}

/* Ensure the main container from base template takes full height */
body>main {
    height: 100%;
    width: 100%;
    display: block;
}

/* Main Layout Wrapper */
.login-wrapper {
    display: flex;
    height: 100%;
    width: 100%;
    min-height: 100vh;
    /* Minimal height is full screen */
}

/* Left Section: Image & Branding */
.login-image-section {
    flex: 1.5;
    /* Larger width (approx 60%) */
    position: relative;
    display: none;
    /* Hidden on mobile by default */
}

.login-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* Overlay to darken image for text readability */
.login-image-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Composite gradient: Vertical dark fade (for text) AND Horizontal fade to white (for blend) */
    background:
        linear-gradient(to right, rgba(250, 249, 246, 0) 0%, rgba(250, 249, 246, 0) 60%, rgba(250, 249, 246, 1) 100%),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 1;
}

.image-overlay {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    /* Align content to top with margin */
    justify-content: flex-start;
    padding: 80px 4rem 4rem 4rem;
}


.brand-content {
    color: white;
    /* Keep white on image overlay */
    max-width: 600px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Logo Styles */
.login-logo-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    position: relative;
    z-index: 10;
    /* Above the letters */
}

.brand-name {
    font-size: 3.2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1;
    display: flex;
    align-items: center;
}

.brand-text-green {
    color: #28a745;
}

.brand-text-white {
    color: #ffffff;
}

.brand-text-green,
.brand-text-white {
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
}

/* Lógica de Animación por Letra */
.anim-letter {
    display: inline-block;
    opacity: 0;
    transform: translateX(-40px) scale(0.8);
    filter: blur(4px);
    animation: revealLetter 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes revealLetter {
    0% {
        opacity: 0;
        transform: translateX(-40px) scale(0.8);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

/* Retardos Escalonados (Secuencial 11 letras) */
.anim-brand-container span:nth-child(1) .anim-letter:nth-child(1) { animation-delay: 0.1s; }
.anim-brand-container span:nth-child(1) .anim-letter:nth-child(2) { animation-delay: 0.2s; }
.anim-brand-container span:nth-child(1) .anim-letter:nth-child(3) { animation-delay: 0.3s; }
.anim-brand-container span:nth-child(1) .anim-letter:nth-child(4) { animation-delay: 0.4s; }
.anim-brand-container span:nth-child(1) .anim-letter:nth-child(5) { animation-delay: 0.5s; }
.anim-brand-container span:nth-child(1) .anim-letter:nth-child(6) { animation-delay: 0.6s; }

.anim-brand-container span:nth-child(2) .anim-letter:nth-child(1) { animation-delay: 0.7s; }
.anim-brand-container span:nth-child(2) .anim-letter:nth-child(2) { animation-delay: 0.8s; }
.anim-brand-container span:nth-child(2) .anim-letter:nth-child(3) { animation-delay: 0.9s; }
.anim-brand-container span:nth-child(2) .anim-letter:nth-child(4) { animation-delay: 1.0s; }
.anim-brand-container span:nth-child(2) .anim-letter:nth-child(5) { animation-delay: 1.1s; }

.brand-headline {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.5;
    opacity: 0.9;
    margin-top: 1rem;
}

.trust-badges {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.avatars-group {
    height: 24px;
}

.trust-text {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Feature Slider Customization */
/* Feature Slider Customization */
#loginFeatureCarousel {
    min-height: 300px;
    perspective: 1500px;
    /* Essential for 3D effect */
}

/* Icons & Text Styling */
.slider-icon i {
    font-size: 3rem;
    color: #28a745;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.slider-category {
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 1px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
}

.slider-description {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    max-width: 500px;
    margin-top: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.brand-headline {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
    /* Enhanced shadow for title */
}

/* Indicators */
.custom-indicators {
    margin-bottom: -2rem;
    justify-content: flex-start;
    margin-left: 0;
    margin-right: 0;
}

.custom-indicators [data-bs-target] {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    border: none;
    margin-right: 12px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.custom-indicators [data-bs-target].active {
    background-color: #28a745;
    width: 30px;
    border-radius: 12px;
}


/* 3D Book Page Flip Animation */
.carousel-inner.scene-3d {
    overflow: visible;
    /* Allowing 3D overflow */
    transform-style: preserve-3d;
}

.carousel-item.book-page {
    opacity: 0;
    transform-origin: left center;
    transform: rotateY(90deg) translateZ(0);
    /* Start "closed" or flipped away */
    transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s ease;
    backface-visibility: hidden;
    /* Hide back side */
    display: block !important;
    /* Force block to manage transitions manually via classes */
    position: absolute;
    /* Stack them */
    top: 0;
    left: 0;
    width: 100%;
}

.carousel-item.book-page.active {
    opacity: 1;
    transform: rotateY(0deg) translateZ(0);
    /* "Open" page */
    position: relative;
    /* Active takes flow */
    z-index: 5;
}

/* Estado Inicial para la animación de contenido interno */
.carousel-item.book-page .slider-icon,
.carousel-item.book-page .slider-category,
.carousel-item.book-page .brand-headline,
.carousel-item.book-page .slider-description,
.carousel-item.book-page img {
    opacity: 0;
    transform: translateY(20px);
    transition: none;
}

/* Animaciones al activarse el slide */
.carousel-item.book-page.active .slider-icon,
.carousel-item.book-page.active .slider-category,
.carousel-item.book-page.active .brand-headline,
.carousel-item.book-page.active .slider-description,
.carousel-item.book-page.active img {
    animation: contentReveal 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* Retardos Escalonados */
.carousel-item.book-page.active .slider-icon { animation-delay: 0.3s; }
.carousel-item.book-page.active .slider-category { animation-delay: 0.4s; }
.carousel-item.book-page.active .brand-headline { animation-delay: 0.5s; }
.carousel-item.book-page.active .slider-description { animation-delay: 0.7s; }
.carousel-item.book-page.active img { 
    animation-name: contentRevealScale;
    animation-delay: 0.9s; 
}

@keyframes contentReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Override Bootstrap's default transition to let ours take over */
.carousel-item-next,
.carousel-item-prev,
.carousel-item.active.carousel-item-start,
.carousel-item.active.carousel-item-end {
    transform: none !important;
    transition: none !important;
}

/* Manual "Exit" Animation for outgoing slide */
/* Note: Bootstrap uses .active.carousel-item-start to indicate outgoing to left */
.carousel-item.book-page.active.carousel-item-start {
    animation: bookFlipOut 1s forwards cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes bookFlipOut {
    0% {
        transform: rotateY(0deg);
        opacity: 1;
    }

    100% {
        transform: rotateY(-30deg);
        /* Subtle flick away */
        opacity: 0;
    }
}


/* Right Section: Form */
.login-form-section {
    flex: 1;
    /* Smaller width (approx 40%) */
    max-width: 600px;
    /* Added for extra control */
    background-color: #faf9f6;
    /* Soft Ivory */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Vertical Center */
    padding: 2rem;
    position: relative;
    width: 100%;
    height: 100%;
    /* Take full height of parent */
    overflow-y: auto;
    /* Allow scrolling if vertical content is too tall */
}

.login-form-container {
    width: 100%;
    max-width: 450px;
    margin: auto;
    /* Ensure centering within flex container */
    background: #ffffff;
    /* White card */
    /* backdrop-filter removed as we want solid white */
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    /* Softer, deeper shadow */
    padding: 3.5rem;
    border-radius: 1.5rem;
}

/* Modo compacto para móviles */
@media (max-width: 768px) {
    .login-form-container {
        padding: 1.5rem 1.25rem !important; /* Relleno mucho más reducido */
        border-radius: 0.75rem !important;
    }
    .form-title {
        font-size: 1.5rem !important; /* Título más pequeño */
    }
    .form-subtitle {
        margin-bottom: 1.25rem !important;
        font-size: 0.85rem !important;
    }
    .login-logo-img {
        width: 45px !important;
        height: 45px !important;
    }
    .login-submit-btn {
        padding: 0.7rem !important;
    }
}

.form-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #212529;
    /* Dark text */
    text-align: center;
}

.form-subtitle {
    color: #6c757d;
    /* Bootstrap secondary */
    margin-bottom: 2rem;
    font-size: 0.95rem;
    text-align: center;
}


/* Input Styling */
.form-label {
    color: #495057;
    /* Darker label */
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.custom-input-group {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    /* Standard border */
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-input-group:focus-within {
    border-color: #28a745;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.1);
}

.custom-input-group .input-group-text {
    background-color: transparent;
    border: none;
    color: #6c757d;
    font-size: 1.1rem;
    padding-left: 1rem;
}

.custom-input-group .form-control {
    background-color: transparent;
    border: none;
    color: #212529;
    /* Dark text */
    padding: 0.75rem 1rem;
    font-size: 1rem;
    box-shadow: none !important;
}

.custom-input-group .form-control::placeholder {
    color: #adb5bd;
}

/* Checkbox */
.login-form-container .form-check {
    display: flex;
    align-items: center;
    padding-left: 0 !important;
    margin-left: 0 !important;
    /* Align with inputs above */
    margin-bottom: 1.5rem;
    /* Add some space below before button */
    min-height: auto;
    /* Reset bootstrap default */
}

.login-form-container .form-check .form-check-input {
    background-color: #fff;
    border: 1px solid #ced4da;
    /* Standard border */
    width: 1.1em;
    height: 1.1em;
    margin-top: 0;
    margin-left: 0.1em !important;
    /* Force reset */
    padding: 0 !important;
    /* Override global input padding */
    cursor: pointer;
    float: none;
    /* Reset bootstrap float */
    margin-right: 0.75rem;
}

.login-form-container .form-check .form-check-input:checked {
    background-color: #2563EB;
    border-color: #2563EB;
}

.login-form-container .form-check .form-check-input:checked[type=checkbox] {
    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 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-check-label {
    color: #495057;
    font-size: 0.9rem;
    cursor: pointer;
    margin-left: 0;
    /* Handled by input margin-right */
}

/* Links */
.forgot-password-link {
    color: #28a745;
    font-size: 0.875rem;
    text-decoration: none;
    font-weight: 500;
}

.forgot-password-link:hover {
    color: #218838;
    text-decoration: underline;
}

/* Primary Button */
.login-submit-btn {
    background-color: #28a745;
    /* UniWeb Green */
    border: none;
    border-radius: 8px;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
}

.login-submit-btn:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.2);
}

/* Footer & Legal */
.form-footer {
    text-align: center;
    color: #6c757d;
    font-size: 0.75rem;
}

/* Desktop Styles */
@media (min-width: 992px) {
    .login-image-section {
        display: flex;
        /* Show image on large screens */
    }
}

/* Mobile/Tablet Styles (< 1000px) */
/* Unified layout: Text hidden, Logo centered, Form centered, Background Image specific adjustments */
@media (max-width: 1000px) {

    /* 1. Image & Background Handling */
    .login-image-section {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 0;
    }

    .login-bg-image {
        opacity: 0.6;
        /* 60% opacity for image only */
    }

    /* 2. Hide all overlay content on mobile since we moved logo to form */
    .brand-content {
        display: none !important;
    }

    /* 3. Center Logo Layout */
    .brand-logo {
        justify-content: center;
        margin-bottom: 2rem;
        width: 100%;
    }

    .brand-content {
        width: 100%;
        display: flex;
        justify-content: center;
        /* Ensure overlay padding doesn't push it weirdly */
        max-width: 100%;
    }

    .image-overlay {
        padding: 4rem 2rem 2rem 2rem;
        /* Reduce padding */
        align-items: center;
    }

    /* 4. Form Layout */
    .login-form-section {
        background-color: transparent !important;
        z-index: 1;

        display: flex;
        flex-direction: column;
        align-items: center;
        /* Horizontally center cross-axis (width) */
        justify-content: center;
        /* Vertically center main-axis (height) */

        padding: 2rem;
        /* Balanced padding */
        padding-top: 120px;
        /* Push form down to clear logo */
        width: 100%;
        max-width: 100%;
        /* Override desktop max-width */
    }

    .login-form-container {
        /* Ensure card remains opaque */
        position: relative;
        z-index: 2;
        margin: 0 auto;
        /* Horizontally center block element */
        width: 100%;
        max-width: 450px;
        /* Ensure max-width applies */
    }
}

/* Password Reset Override */
#password-reset-container {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-top: 1.5rem;
}