{% load static i18n %}
{% get_current_language_bidi as LANGUAGE_BIDI %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<html lang="{{LANGUAGE_CODE}}" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>KAAUH ATS - Sign In (Bootstrap)</title>
    
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    
    
    <style>
        /* -------------------------------------------------------------------------- */
        /* CUSTOM TEAL THEME OVERRIDES FOR BOOTSTRAP */
        /* -------------------------------------------------------------------------- */
        :root {
            /* Define TEAL as the primary color for Bootstrap overrides */
            --bs-primary: #00636e; /* Dark Teal */
            --bs-primary-rgb: 0, 99, 110;
            --bs-primary-light: #007a88; /* Lighter Teal for hover */
            
            /* Background and Text Colors */
            --bs-body-bg: #f8f9fa; /* Light gray background */
            --bs-body-color: #212529; /* Dark text */

            /* Utility colors */
            --bs-border-color: #dee2e6; /* Bootstrap default border */
        }
        
        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bs-body-bg);
        }

        /* Custom Left Panel (Replicating the original look) */
        .left-panel {
            flex: 1;
            background: url("{% static 'image/kaauh_banner.png' %}") no-repeat center center;
            background-size: cover;
            position: relative;
            display: flex;
            align-items: flex-end;
            padding: 3rem;
            color: white;
            z-index: 1;
        }
        .left-panel::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 50%);
            z-index: 0;
        }
        .left-panel-content {
            position: relative;
            z-index: 2;
            /* No change here */
        }

        /* Right Panel Styling */
        .right-panel {
            background-color: white;
            padding: 3rem;
        }
        .form-fields {
            max-height: 100%;
            overflow-y: auto;
        }

        /* Component Overrides to use Teal Theme (No change) */
        .btn-primary {
            background-color: var(--bs-primary);
            border-color: var(--bs-primary);
            font-weight: 600;
            border-radius: 0.5rem; 
            box-shadow: 0 4px 8px rgba(0, 99, 110, 0.2); 
            transition: all 0.2s ease;
        }
        .btn-primary:hover {
            background-color: var(--bs-primary-light);
            border-color: var(--bs-primary-light);
            box-shadow: 0 6px 10px rgba(0, 99, 110, 0.3);
        }
        .form-control:focus {
            border-color: var(--bs-primary);
            box-shadow: 0 0 0 0.25rem rgba(0, 99, 110, 0.25);
        }
        .form-check-input:checked {
            background-color: var(--bs-primary);
            border-color: var(--bs-primary);
        }
        .text-accent {
            color: var(--bs-primary) !important;
        }
        .text-accent:hover {
            color: var(--bs-primary-light) !important;
            text-decoration: underline;
        }
        
        /* ADJUSTED: Custom size adjustment for right panel on desktop */
        @media (min-width: 992px) {
            /* 1. Set a NARROWER fixed width for the right panel container */
            .right-panel-col {
                flex: 0 0 450px; /* Reduced from 800px to 450px */
            }
            /* 2. Vertically and horizontally center the content within the narrow panel */
            .right-panel-col > .d-flex {
                height: 100%;
                justify-content: center;
                align-items: center;
                padding-top: 0;
                padding-bottom: 0;
            }
            /* 3. Ensure the form container doesn't exceed a smaller size and is centered */
            .right-panel-content-wrapper {
                 max-width: 350px; /* Max width of the form elements inside the panel */
                 width: 100%;
            }
        }
    </style>
</head>
<body>

    <div class="d-flex vh-100 w-100">

        <div class="left-panel d-none d-lg-flex flex-grow-1">
            <div class="left-panel-content">
                <h1 class="text-4xl font-weight-bold mb-4" style="font-size: 1.5rem;">
                    <span class="text-white">
                        <div class="hospital-text text-center text-md-start me-3">
                            <div class="ar small">جامعة الأميرة نورة بنت عبدالرحمن الأكاديمية</div>
                            <div class="ar small">ومستشفى الملك عبدالله بن عبدالعزيز التخصصي</div>
                            <div class="en small">Princess Nourah bint Abdulrahman University</div>
                            <div class="en small">King Abdullah bin Abdulaziz University Hospital</div>
                        </div>
                    </span>
                </h1>
                <small>Powered By TENHAL | تنحل</small>
            </div>
        </div>

        <div class="d-flex flex-column right-panel right-panel-col flex-grow-1 align-items-center justify-content-center">
            
            <div class="right-panel-content-wrapper">
                
                <h2 id="form-title" class="h3 fw-bold mb-4 text-center">{% trans "Sign In" %}</h2>
              
                <div class="form-fields">
                    <form id="login-form" class="space-y-4" method="post" action="{% url 'account_login' %}">
                        {% csrf_token %} 
                        
                        <div class="mb-3">
                            <label for="id_login" class="form-label fw-semibold"> {% trans "Email *" %}</label>
                            <input type="text" name="login" id="id_login" class="form-control" placeholder="{% trans 'Enter your email' %}" required autofocus>
                        </div>
                        
                        <div class="mb-3">
                            <label for="id_password" class="form-label fw-semibold">{% trans "Password *" %}</label>
                            <input type="password" name="password" id="id_password" class="form-control" placeholder="{% trans 'Password' %}" required>
                            
                            <div class="text-end mt-2">
                                <a href="{% url 'account_reset_password' %}" class="small text-accent fw-medium">{% trans 'Forgot Password?' %}</a>
                            </div>
                        </div>

                        <div class="form-check pt-3">
                            <input class="form-check-input" type="checkbox" name="remember" id="id_remember">
                            <label class="form-check-label text-muted" for="id_remember">
                                {% trans "Keep me signed in" %}
                            </label>
                        </div>
                        
                        <button type="submit" class="btn btn-primary w-100 mt-4">{% trans "Sign In" %}</button>
                    </form>
                </div>
            </div>

            </div>
    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>