:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --error-color: #ef4444;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-gradient-start);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* --- Split Layout Container --- */
.login-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
}

/* --- Left Side: Visual --- */
.login-visual {
    flex: 1.5;
    /* 60% width roughly */
    position: relative;
    overflow: hidden;
    background-color: #0f172a;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    color: white;
}

.visual-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 0.8;
    /* Blend mode for better text readability if needed, usually image is enough */
}

.visual-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom right, rgba(15, 23, 42, 0.4), rgba(79, 70, 229, 0.4));
    z-index: 1;
}

.brand-intro {
    position: relative;
    z-index: 2;
    animation: fadeSlideDown 1s ease-out;
}

.brand-intro h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.brand-intro p {
    font-size: 1.25rem;
    opacity: 0.9;
    font-weight: 300;
}

.visual-footer {
    position: relative;
    z-index: 2;
    font-size: 0.875rem;
    opacity: 0.6;
    animation: fadeIn 1s ease-out 0.5s backwards;
}

/* --- Right Side: Form --- */
.login-form-container {
    flex: 1;
    /* 40% width roughly */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 3rem;
    background: transparent;
    /* No card bg needed in split view */
    animation: fadeSlideUp 0.8s ease-out;
}

.form-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.form-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-header p {
    color: var(--text-muted);
}

/* --- Inputs & Buttons --- */
.form-floating {
    margin-bottom: 1.25rem;
    position: relative;
}

.form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 1rem 1rem;
    height: 3.5rem;
    /* Touch friendly */
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.btn-login {
    width: 100%;
    padding: 1rem;
    height: 3.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.btn-login:active {
    transform: scale(0.98);
}

.form-check-input {
    width: 1.2em;
    height: 1.2em;
    margin-top: 0.1em;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* --- Alerts --- */
.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    animation: fadeIn 0.5s ease-out;
}

/* --- Animations --- */
@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* --- Responsive & iPad Optimizations --- */

/* Mobile / Portrait Mode */
@media (max-width: 991.98px) {
    .login-wrapper {
        display: block;
        position: relative;
    }

    .login-visual {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        padding: 2rem;
        align-items: center;
        text-align: center;
        justify-content: flex-start;
        padding-top: 15vh;
    }

    .brand-intro h1 {
        font-size: 2.5rem;
    }

    .brand-intro p {
        font-size: 1rem;
    }

    .visual-footer {
        display: none;
    }

    /* Hide footer on mobile for cleaner look */

    .login-form-container {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        min-height: 60vh;
        background: white;
        /* Solid background for input area */
        border-top-left-radius: 30px;
        border-top-right-radius: 30px;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
        display: block;
        padding: 2rem 1.5rem;
        z-index: 10;
    }

    .login-card {
        padding: 0;
        max-width: 100%;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
    }

    /* On smaller screens, form header can be smaller */
    .form-header {
        margin-bottom: 2rem;
    }

    .form-header h2 {
        font-size: 1.75rem;
    }
}

/* iPad Air Landscape specific tweaks */
/* Logic: Viewport allows seeing width, but generally iPad Air is tablet size. 
   The default Split Layout above works well for > 992px.
   We just ensure fonts and inputs are large enough for touch. */

@media (min-width: 992px) {

    /* Safe Area Insets for modern devices */
    .login-wrapper {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}
/* ¸ð¹ÙÀÏ ÅÍÄ¡ ÃÖÀûÈ­ */
* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
}

.btn-login,
.form-control,
.form-check-input,
.forgot-link {
    touch-action: manipulation;
}

.form-control {
    -webkit-user-select: text;
    user-select: text;
}

.btn-login {
    min-height: 44px !important;
}

.form-check-input {
    min-width: 22px;
    min-height: 22px;
    cursor: pointer;
}

.forgot-link {
    display: inline-block;
    padding: 8px;
    margin: -8px;
}
