/* ==========================================================================
   INVENTARIS LAB - MODERN RESPONSIVE LOGIN STYLING
   Optimized for: Ultra-wide, Desktop, Laptop, iPad/Tablet, and Mobile Viewports
   ========================================================================== */

:root {
    --login-primary: #0d1b3e;
    --login-primary-hover: #1e3a8a;
    --login-primary-light: rgba(13, 27, 62, 0.08);
    --login-accent: #2563eb;
    --login-accent-hover: #1d4ed8;
    --login-bg: #f8fafc;
    --login-card: #ffffff;
    --login-text-dark: #0f172a;
    --login-text-muted: #64748b;
    --login-border: #e2e8f0;
    --login-border-focus: #0d1b3e;
    --login-input-bg: #f8fafc;
    --login-radius: 14px;
    --login-shadow: 0 10px 25px -5px rgba(13, 27, 62, 0.08), 0 8px 10px -6px rgba(13, 27, 62, 0.04);
}

/* Reset / Base overrides for Login View */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
}

body {
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--login-bg);
    color: var(--login-text-dark);
    -webkit-font-smoothing: antialiased;
}

/* ================= MAIN CONTAINER ================= */
.body-login {
    display: flex !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    height: auto !important;
    width: 100% !important;
    background-color: var(--login-bg) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
}

/* ================= LEFT SECTION (BRAND & ILLUSTRATION) ================= */
.figure-section {
    flex: 1 1 50%;
    min-width: 0;
    background: linear-gradient(140deg, #060d24 0%, #0d1b3e 48%, #172554 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
}

/* Ambient glow accents behind the figure */
.figure-section::before {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.22) 0%, rgba(13, 27, 62, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.figure-section::after {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, rgba(13, 27, 62, 0) 70%);
    bottom: 10%;
    right: 10%;
    pointer-events: none;
    z-index: 1;
}

.logo-container {
    position: absolute;
    top: 2.25rem;
    left: 2.5rem;
    z-index: 10;
}

.logo-container a {
    display: inline-block;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.logo-container a:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.logo-container img {
    height: 44px;
    width: auto;
    max-width: 260px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.figure-content {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    padding: 1rem 0;
}

/* Override fixed width from style.css */
#login-figure,
.figure-content img {
    width: 100% !important;
    max-width: 430px !important;
    height: auto !important;
    max-height: 52vh !important;
    object-fit: contain !important;
    animation: floatIllustration 5.5s ease-in-out infinite;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.3));
    display: block !important;
}

@keyframes floatIllustration {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-14px);
    }
}

/* ================= RIGHT SECTION (LOGIN FORM) ================= */
.form-section {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2.5rem;
    background-color: var(--login-card);
    min-height: 100vh;
    min-height: 100dvh;
    box-sizing: border-box;
    position: relative;
}

.form-container {
    width: 100%;
    max-width: 440px;
    box-sizing: border-box;
    margin: auto 0;
}

/* Top Nav / Back Link & Mobile Logo Bar */
.form-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    width: 100%;
}

.btn-back-home {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--login-text-muted);
    text-decoration: none !important;
    padding: 0.45rem 0.9rem;
    border-radius: 9999px;
    background-color: #f1f5f9;
    border: 1px solid var(--login-border);
    transition: all 0.2s ease;
}

.btn-back-home:hover {
    color: var(--login-primary);
    background-color: #e2e8f0;
    transform: translateX(-3px);
}

.btn-back-home i {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.btn-back-home:hover i {
    transform: translateX(-2px);
}

.mobile-logo-inline {
    display: none;
}

.mobile-logo-inline img {
    height: 38px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

/* Legacy mobile-logo fallback */
.mobile-logo {
    display: none;
}

/* Form Header */
.form-header {
    margin-bottom: 2rem;
    text-align: left;
}

.form-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--login-primary);
    margin: 0 0 0.4rem 0;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.form-header p {
    color: var(--login-text-muted);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

/* Form Groups & Inputs */
.form-group {
    margin-bottom: 1.35rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: 0.1px;
}

.input-icon-group {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

.input-icon {
    position: absolute !important;
    left: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #94a3b8 !important;
    font-size: 0.95rem !important;
    pointer-events: none !important;
    z-index: 5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: color 0.2s ease !important;
}

/* Reset and style inputs cleanly (overriding style.css input rule) */
.form-control-login,
.form-group input {
    width: 100% !important;
    height: 52px !important;
    padding: 0.75rem 1.1rem 0.75rem 2.85rem !important;
    border: 1.5px solid var(--login-border) !important;
    border-radius: var(--login-radius) !important;
    font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
    font-family: inherit !important;
    background-color: var(--login-input-bg) !important;
    color: var(--login-text-dark) !important;
    box-sizing: border-box !important;
    margin-top: 0 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: none !important;
}

.form-control-login:focus,
.form-group input:focus {
    outline: none !important;
    border-color: var(--login-primary) !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(13, 27, 62, 0.1) !important;
}

.input-icon-group:focus-within .input-icon {
    color: var(--login-primary) !important;
}

.form-group input::placeholder,
.form-control-login::placeholder {
    color: #94a3b8 !important;
    font-size: 0.9rem !important;
    font-weight: 400 !important;
}

/* Password Toggle Button */
.form-control-login.has-toggle {
    padding-right: 3.25rem !important;
}

.btn-toggle-password {
    position: absolute !important;
    right: 0.5rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: #94a3b8 !important;
    font-size: 0.95rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    border-radius: 8px !important;
    z-index: 5 !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    margin: 0 !important;
}

.btn-toggle-password:hover {
    color: var(--login-primary) !important;
    background-color: #f1f5f9 !important;
}

.btn-toggle-password:focus {
    outline: none !important;
    color: var(--login-primary) !important;
}

/* Forgot Password */
.forgot-password-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: -0.25rem;
    margin-bottom: 1.75rem;
}

.forgot-password-link {
    font-size: 0.85rem;
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    display: inline-block;
    padding: 2px 0;
}

.forgot-password-link:hover {
    color: var(--login-accent-hover);
    text-decoration: underline;
}

/* Submit Button */
.btn-login {
    width: 100% !important;
    height: 52px !important;
    padding: 0 1.5rem !important;
    background: var(--login-primary) !important;
    color: #ffffff !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: var(--login-radius) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-family: inherit !important;
    box-shadow: 0 4px 14px rgba(13, 27, 62, 0.18) !important;
    letter-spacing: 0.2px;
}

.btn-login:hover {
    background: var(--login-primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 27, 62, 0.26) !important;
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(13, 27, 62, 0.15) !important;
}

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

/* Register prompt */
.register-prompt {
    margin-top: 1.75rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--login-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.register-link {
    color: var(--login-accent);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.register-link:hover {
    color: var(--login-accent-hover);
    text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (MOBILE-FIRST ADAPTATIONS)
   ========================================================================== */

/* 1. Medium Desktops & Laptops (992px - 1200px) */
@media (max-width: 1200px) {
    .figure-section {
        padding: 2.5rem 2rem;
    }

    .logo-container {
        top: 2rem;
        left: 2rem;
    }

    .logo-container img {
        height: 38px;
    }

    .form-section {
        padding: 2.5rem 2rem;
    }

    .form-container {
        max-width: 400px;
    }
}

/* 2. Tablets (Landscape & Portrait, max-width: 991.98px) */
@media (max-width: 991.98px) {
    .body-login {
        flex-direction: column !important;
        background-color: #f1f5f9 !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
    }

    /* Hide heavy illustration column on tablets/mobile */
    .figure-section {
        display: none !important;
    }

    /* Show mobile brand logo inline */
    .mobile-logo-inline {
        display: block !important;
    }

    .form-section {
        flex: 1 1 100% !important;
        width: 100% !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        padding: 2.5rem 1.5rem !important;
        background-color: transparent !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Elegant elevated card for tablet */
    .form-container {
        background: #ffffff;
        padding: 2.5rem 2.25rem;
        border-radius: 20px;
        box-shadow: 0 10px 25px -5px rgba(13, 27, 62, 0.08), 0 8px 10px -6px rgba(13, 27, 62, 0.04);
        border: 1px solid var(--login-border);
        max-width: 460px;
        width: 100%;
        margin: auto;
    }

    .form-header h2 {
        font-size: 1.75rem;
    }
}

/* 3. Mobile Phones (max-width: 575.98px) */
@media (max-width: 575.98px) {
    .form-section {
        padding: 1.25rem 1rem !important;
        align-items: center !important;
    }

    .form-container {
        padding: 1.75rem 1.25rem !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 18px rgba(13, 27, 62, 0.06) !important;
    }

    .form-nav-bar {
        margin-bottom: 1.5rem !important;
    }

    .btn-back-home {
        padding: 0.35rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    .mobile-logo-inline img {
        height: 34px !important;
        max-width: 130px !important;
    }

    .form-header {
        margin-bottom: 1.5rem !important;
    }

    .form-header h2 {
        font-size: 1.5rem !important;
    }

    .form-header p {
        font-size: 0.875rem !important;
    }

    .form-group {
        margin-bottom: 1.15rem !important;
    }

    .form-control-login,
    .form-group input {
        height: 48px !important;
        font-size: 16px !important; /* Must be 16px to prevent iOS auto-zoom */
        padding-left: 2.65rem !important;
    }

    .input-icon {
        left: 0.95rem !important;
        font-size: 0.9rem !important;
    }

    .btn-toggle-password {
        width: 36px !important;
        height: 36px !important;
    }

    .forgot-password-wrapper {
        margin-bottom: 1.5rem !important;
    }

    .btn-login {
        height: 48px !important;
        font-size: 0.95rem !important;
    }

    .register-prompt {
        margin-top: 1.35rem !important;
        font-size: 0.85rem !important;
    }
}

/* 4. Ultra-Small Devices (e.g. Galaxy Fold, iPhone SE 1st gen, max-width: 360px) */
@media (max-width: 360px) {
    .form-section {
        padding: 0.85rem 0.65rem !important;
    }

    .form-container {
        padding: 1.35rem 1rem !important;
    }

    .btn-back-home span {
        display: none !important; /* Show icon only to save space */
    }

    .btn-back-home {
        padding: 0.4rem 0.6rem !important;
    }

    .mobile-logo-inline img {
        height: 28px !important;
    }

    .form-header h2 {
        font-size: 1.35rem !important;
    }
}

/* 5. Landscape Mode on Mobile or Short Height Viewports (max-height: 650px) */
@media (max-height: 650px) and (orientation: landscape) {
    .body-login {
        overflow-y: auto !important;
    }

    .form-section {
        min-height: auto !important;
        padding: 1.5rem 1rem !important;
    }

    .form-container {
        margin: 1rem auto !important;
        padding: 1.5rem 1.25rem !important;
    }

    .form-nav-bar {
        margin-bottom: 1rem !important;
    }

    .form-header {
        margin-bottom: 1rem !important;
    }

    .form-group {
        margin-bottom: 0.85rem !important;
    }

    .forgot-password-wrapper {
        margin-bottom: 1rem !important;
    }

    .register-prompt {
        margin-top: 1rem !important;
    }
}