/* ================================================================
   MedinGate — Login Page Styles
   Bootstrap 5 · RTL/LTR · Arabic-first
   ================================================================ */

/* ── Custom font (DIN Next Arabic) ─────────────────────────────── */
@font-face {
    font-family: 'DIN';
    src: url('/frontend/web/fonts/DINNEXTLTARABIC-LIGHT-2-2.ttf') format('truetype');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

/* ── Design tokens ──────────────────────────────────────────────── */
:root {
    --mg-primary:       #1b7398;
    --mg-primary-dark:  #0d4f73;
    --mg-primary-light: #e8f4f9;
    --mg-accent:        #2db4e8;
    --mg-text:          #1a2e3b;
    --mg-muted:         #6b8899;
    --mg-border:        #d6e8f2;
    --mg-white:         #ffffff;
    --mg-header-h:      68px;
    --mg-footer-h:      52px;
    --mg-radius:        12px;
    --mg-shadow:        0 8px 32px rgba(13, 79, 115, 0.13);
    --mg-font:          'DIN', 'Segoe UI', Tahoma, sans-serif;
}

/* ── Base reset ──────────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body.mg-login-body {
    font-family: var(--mg-font);
    background-color: #f0f6fb;
    color: var(--mg-text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ════════════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════════════ */
.mg-header {
    height: var(--mg-header-h);
    background: var(--mg-white);
    border-bottom: 1px solid var(--mg-border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.mg-header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 2rem;
    gap: 1rem;
}

.mg-logo-link { display: flex; align-items: center; text-decoration: none; }
.mg-logo-img  { height: 44px; width: auto; }

.mg-app-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--mg-primary);
    letter-spacing: 0.02em;
}

/* Language button */
.mg-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    background: var(--mg-primary-light);
    border: 1.5px solid var(--mg-border);
    border-radius: 8px;
    color: var(--mg-primary-dark);
    font-family: var(--mg-font);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.mg-lang-btn:hover,
.mg-lang-btn.show {
    background: var(--mg-primary);
    border-color: var(--mg-primary);
    color: var(--mg-white);
}
.mg-lang-btn img { border-radius: 2px; }

.mg-lang-menu {
    min-width: 150px;
    border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius);
    box-shadow: var(--mg-shadow);
    overflow: hidden;
}
.mg-lang-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--mg-font);
    font-size: 0.9rem;
    padding: 0.55rem 1rem;
    color: var(--mg-text);
    transition: background 0.15s;
}
.mg-lang-menu .dropdown-item img { border-radius: 2px; }
.mg-lang-menu .dropdown-item:hover,
.mg-lang-menu .dropdown-item.active {
    background: var(--mg-primary-light);
    color: var(--mg-primary-dark);
}
.mg-lang-menu .dropdown-item.active { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════
   MAIN
   ════════════════════════════════════════════════════════════════ */
.mg-main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* ════════════════════════════════════════════════════════════════
   SPLIT LAYOUT
   ════════════════════════════════════════════════════════════════ */
.mg-split-wrap {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--mg-header-h) - var(--mg-footer-h));
}

/* ── Hero panel (image + branding) ───────────────────────────────
   HTML order: hero FIRST  →  LTR = left,  RTL (Bootstrap reverses) = right  */
.mg-hero-panel {
    flex: 0 0 58%;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(10, 45, 65, 0.82) 0%, rgba(27, 115, 152, 0.72) 100%),
        url('../images/bg-01.jpg') center / cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 3.5rem;
}

.mg-hero-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 50%, rgba(45, 180, 232, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.mg-hero-content {
    position: relative;
    color: var(--mg-white);
    max-width: 520px;
}

.mg-hero-logo-wrap { margin-bottom: 2rem; }
.mg-hero-logo {
    height: 56px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.92;
}

.mg-hero-headline {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mg-hero-tagline {
    font-size: 1rem;
    opacity: 0.88;
    line-height: 1.7;
    margin-bottom: 2rem;
}

.mg-hero-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.mg-hero-features li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.95rem;
    opacity: 0.9;
}
.mg-hero-features .fa-circle-check {
    color: #6ee7b7;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Decorative circles */
.mg-hero-panel::before,
.mg-hero-panel::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}
.mg-hero-panel::before {
    width: 420px; height: 420px;
    bottom: -120px; right: -80px;
}
.mg-hero-panel::after {
    width: 260px; height: 260px;
    top: -60px; left: -60px;
}

/* ── Form panel ──────────────────────────────────────────────────
   HTML order: form SECOND  →  LTR = right,  RTL = left              */
.mg-form-panel {
    flex: 0 0 42%;
    background: #f0f6fb;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    overflow-y: auto;
}

.mg-form-inner {
    width: 100%;
    max-width: 400px;
    background: var(--mg-white);
    border: 1.5px solid var(--mg-border);
    border-radius: var(--mg-radius);
    box-shadow: 0 4px 24px rgba(13, 79, 115, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 2.25rem 2rem;
}

/* Form head */
.mg-form-head {
    text-align: center;
    margin-bottom: 2rem;
}

.mg-form-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--mg-primary-light);
    border: 3px solid var(--mg-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.mg-form-avatar .fa-user-doctor {
    font-size: 1.75rem;
    color: var(--mg-primary);
}

.mg-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mg-text);
    margin-bottom: 0.35rem;
}

.mg-form-subtitle {
    font-size: 0.9rem;
    color: var(--mg-muted);
    margin: 0;
}

/* ── Form fields ──────────────────────────────────────────────── */
.mg-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mg-primary-dark);
    margin-bottom: 0.4rem;
}
.mg-label .mg-field-icon {
    color: var(--mg-primary);
    opacity: 0.8;
}

.mg-input {
    width: 100%;
    height: 46px;
    border: 1.5px solid var(--mg-border);
    border-radius: 8px;
    padding: 0 0.85rem;
    font-family: var(--mg-font);
    font-size: 0.95rem;
    color: var(--mg-text);
    background: #fafcfe;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.mg-input:focus {
    outline: none;
    border-color: var(--mg-primary);
    box-shadow: 0 0 0 3px rgba(27, 115, 152, 0.15);
    background: var(--mg-white);
}
.mg-input::placeholder { color: #b0c4d0; font-size: 0.88rem; }

/* Password toggle wrapper */
.mg-input-wrap {
    position: relative;
}
.mg-input-wrap .mg-input {
    padding-inline-end: 2.8rem;
}
.mg-eye-btn {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: 0.75rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.2rem;
    cursor: pointer;
    color: var(--mg-muted);
    line-height: 1;
    transition: color 0.15s;
}
.mg-eye-btn:hover { color: var(--mg-primary); }

/* Remember me & Forgot */
.mg-check-label {
    font-size: 0.88rem;
    color: var(--mg-text);
    cursor: pointer;
}
.form-check-input:checked {
    background-color: var(--mg-primary);
    border-color: var(--mg-primary);
}

.mg-forgot {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mg-primary);
    text-decoration: none;
}
.mg-forgot:hover {
    text-decoration: underline;
    color: var(--mg-primary-dark);
}

/* Login button */
.mg-btn-login {
    background: linear-gradient(135deg, var(--mg-primary-dark), var(--mg-primary));
    border: none;
    color: var(--mg-white);
    font-family: var(--mg-font);
    font-weight: 700;
    font-size: 1rem;
    height: 50px;
    border-radius: 10px;
    letter-spacing: 0.03em;
    transition: all 0.25s;
    box-shadow: 0 4px 16px rgba(27, 115, 152, 0.35);
}
.mg-btn-login:hover,
.mg-btn-login:focus {
    background: linear-gradient(135deg, #0a3a52, #155e80);
    color: var(--mg-white);
    box-shadow: 0 6px 20px rgba(27, 115, 152, 0.45);
    transform: translateY(-1px);
}
.mg-btn-login:active { transform: translateY(0); }

/* Force white text on login button in RTL (Arabic) — overrides Bootstrap RTL btn resets */
[dir="rtl"] .mg-btn-login,
[dir="rtl"] .mg-btn-login:hover,
[dir="rtl"] .mg-btn-login:focus,
[dir="rtl"] .mg-btn-login:active {
    color: #ffffff !important;
}

/* Validation feedback */
.invalid-feedback {
    font-size: 0.8rem;
    margin-top: 0.3rem;
    display: block;
}
.mg-input.is-invalid,
.field-loginform-username .mg-input.input-validation-error,
.field-loginform-passwordhash .mg-input.input-validation-error {
    border-color: #dc3545;
    background-color: #fff8f8;
}

/* ════════════════════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════════════════════ */
.mg-footer {
    height: var(--mg-footer-h);
    background: var(--mg-primary-dark);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.82rem;
    flex-shrink: 0;
}
.mg-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.mg-footer-right { opacity: 0.7; }
.mg-footer-right strong { color: var(--mg-white); }

/* ════════════════════════════════════════════════════════════════
   RTL ADJUSTMENTS
   ════════════════════════════════════════════════════════════════ */
[dir="rtl"] .mg-hero-panel::before { right: auto; left:  -80px; }
[dir="rtl"] .mg-hero-panel::after  { left:  auto; right: -60px; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — tablet (≤ 991px): stack vertically
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
    .mg-split-wrap {
        flex-direction: column;
        min-height: unset;
    }
    .mg-hero-panel,
    .mg-form-panel {
        flex: unset;
        width: 100%;
    }
    .mg-hero-panel {
        padding: 2.5rem 2rem;
        min-height: 260px;
    }
    .mg-hero-headline { font-size: 1.5rem; }
    .mg-hero-features { display: none; }  /* hide on small screens to keep it clean */
    .mg-form-panel { padding: 2rem 1.5rem; }
    .mg-form-inner { max-width: 440px; }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — mobile (≤ 575px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 575.98px) {
    :root {
        --mg-header-h: 58px;
        --mg-footer-h: 44px;
    }
    .mg-header-inner { padding: 0 1rem; }
    .mg-logo-img { height: 36px; }
    .mg-hero-panel { min-height: 200px; padding: 2rem 1.25rem; }
    .mg-hero-logo { height: 44px; }
    .mg-hero-tagline { display: none; }
    .mg-form-panel { padding: 1.75rem 1.25rem; }
    .mg-footer-inner { padding: 0 1rem; }
    .mg-footer-right { display: none; }
}

/* ════════════════════════════════════════════════════════════════
   SMOOTH ENTRANCE ANIMATION
   ════════════════════════════════════════════════════════════════ */
@keyframes mgFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mg-form-inner {
    animation: mgFadeUp 0.45s ease both;
}
.mg-hero-content {
    animation: mgFadeUp 0.5s 0.1s ease both;
}
