/* ============================================
   auth.css — Unified Authentication Stylesheet
   ============================================ */

/* --- Reset & Base --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* --- Auth Wrapper (Mobile: Bottom Sheet / Desktop: Split Screen) --- */
.auth-wrapper {
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport — أفضل للهاتف */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
    position: relative;
    background-image: linear-gradient(rgba(13, 110, 253, 0.85), rgba(0, 0, 0, 0.9)),
                      url('https://mws.per.jo/pub/images/site_0326_0044-594-0-20151104133439_uJjNgDB.webp');
    background-size: cover;
    background-position: center;
    padding: 0;
}

.form-side {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* --- Auth Card (Shared) --- */
.auth-card {
    background-color: #ffffff;
    /* تم زيادة الهامش السفلي هنا إلى 5rem ليناسب جميع الهواتف */
    padding: 1.5rem 1.25rem calc(5rem + env(safe-area-inset-bottom, 0px)) 1.25rem; 
    border-radius: 1.5rem 1.5rem 0 0;
    box-shadow: 0 -1rem 3rem rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-padding-bottom: 2rem;
}

.auth-card.auth-card-pb {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

/* --- Desktop: Split Screen --- */
@media (min-width: 992px) {
    .auth-wrapper {
        background: none;
        flex-direction: row;
        padding: 0;
        justify-content: center;
        align-items: center;
    }

    .visual-side {
        flex: 1;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background-image: linear-gradient(rgba(13, 110, 253, 0.85), rgba(0, 0, 0, 0.9)),
                          url('https://mws.per.jo/pub/images/site_0326_0044-594-0-20151104133439_uJjNgDB.webp');
        background-size: cover;
        background-position: center;
    }

    .visual-logo {
        max-width: 150px;
        filter: brightness(0) invert(1);
    }

    .form-side {
        flex: 1;
        height: 100%;
        align-items: center;
        justify-content: center;
        background-color: #f8f9fa;
        width: auto;
    }

    .auth-card {
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        background-color: #fff;
        padding: 2.5rem; /* على سطح المكتب يعود للهامش المتساوي */
        max-width: 450px;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 1rem;
        padding-bottom: 2.5rem; /* إلغاء الهامش الإضافي للهاتف على الشاشات الكبيرة */
    }

    .auth-card.auth-card-sm { max-width: 380px; }
    .auth-card.auth-card-md { max-width: 400px; }
    .auth-card.auth-card-lg { max-width: 450px; }
}

/* ============================================
   إصلاح ظهور حقول الإدخال على كل الشاشات
   والمتصفحات (Cross-Browser Input Fix)
   ============================================ */

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="tel"],
.auth-card input[type="number"],
.auth-card input[type="search"],
.auth-card input[type="url"],
.auth-card textarea,
.auth-card select,
.auth-card .form-control,
.auth-card .form-control-lg {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    background-color: #ffffff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    visibility: visible;
    opacity: 1;
    margin: 0;
    font-family: inherit;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* iOS: منع تكبير الشاشة التلقائي — 16px كحد أدنى */
@media (max-width: 991.98px) {
    .auth-card input[type="text"],
    .auth-card input[type="email"],
    .auth-card input[type="password"],
    .auth-card input[type="tel"],
    .auth-card input[type="number"],
    .auth-card input[type="search"],
    .auth-card input[type="url"],
    .auth-card .form-control,
    .auth-card .form-control-lg {
        font-size: 16px;
    }
}

/* Focus state */
.auth-card input:focus,
.auth-card .form-control:focus,
.auth-card .form-control-lg:focus {
    color: #212529;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* إصلاح Autofill في Chrome/Safari */
.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus,
.auth-card .form-control:-webkit-autofill,
.auth-card .form-control:-webkit-autofill:hover,
.auth-card .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #212529;
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
    caret-color: #212529;
    transition: background-color 5000s ease-in-out 0s;
}

/* Placeholder — ظهور واضح على كل المتصفحات */
.auth-card input::placeholder,
.auth-card .form-control::placeholder {
    color: #6c757d;
    opacity: 1;
}

.auth-card input:-ms-input-placeholder,
.auth-card .form-control:-ms-input-placeholder {
    color: #6c757d;
}

/* منع اختفاء الحقول خلف عناصر أخرى */
.auth-card .form-group,
.auth-card .mb-2,
.auth-card .mb-3 {
    position: relative;
    z-index: 1;
}

/* --- Buttons --- */
.auth-card .btn-lg {
    padding: 0.6rem;
    font-size: 1rem;
    min-height: 44px;
}

.auth-card .btn-sm {
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
}

.auth-card .mb-3 {
    margin-bottom: 0.75rem !important;
}

button, .btn {
    border-radius: 0.6rem !important;
}

/* --- Google Button --- */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    background-color: #FFFFFF;
    border: 1px solid #DDDDDD;
    border-radius: 4px;
    text-decoration: none;
    color: #757575;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    box-sizing: border-box;
}

.google-btn:hover {
    background-color: #F8F9FA;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #757575;
    text-decoration: none;
}

.google-icon {
    width: 18px;
    height: 18px;
    margin-inline-end: 12px;
    flex-shrink: 0;
}

/* --- Form Check --- */
.auth-card .form-check-input {
    min-width: 16px;
    min-height: 16px;
    margin-top: 0.25em;
    cursor: pointer;
}

/* --- Misc --- */
.auth-card .form-label {
    display: inline-block;
    margin-bottom: 0.25rem;
}