/* =========================================================
   Trust Group - Login page
   Modern split-card design, RTL / Arabic ready.
   Plain CSS - no frameworks, no external fonts or icons.
   ========================================================= */

:root {
    --bg: #eef1fb;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #dde2f0;
    --field: #f6f8fc;

    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --accent: #06b6d4;

    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    --ring: rgba(79, 70, 229, 0.18);
    --shadow: 0 30px 70px -20px rgba(30, 27, 75, 0.35),
              0 12px 24px -12px rgba(30, 27, 75, 0.18);

    --font: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Kufi Arabic", Arial, sans-serif;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 88px 20px 32px;
    overflow-x: hidden;
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
        radial-gradient(700px 480px at -10% 110%, rgba(6, 182, 212, 0.18), transparent 60%),
        var(--bg);
    background-attachment: fixed;
}

a,
button,
select,
input {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

/* =========================================================
   Top bar + quick links (.off-screen-menu / .ham-menu)
   Mobile: hamburger + dropdown.  Desktop: inline pills.
   ========================================================= */
.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 64px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    z-index: 20;
}

.topbar nav {
    display: flex;
}

.ham-menu {
    position: relative;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s var(--ease);
}

.ham-menu:hover {
    background: rgba(15, 23, 42, 0.06);
}

.ham-menu span {
    position: absolute;
    left: 11px;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: top 0.25s var(--ease), transform 0.25s var(--ease), opacity 0.2s var(--ease);
}

.ham-menu span:nth-child(1) { top: 13px; }
.ham-menu span:nth-child(2) { top: 21px; }
.ham-menu span:nth-child(3) { top: 29px; }

.ham-menu.active span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.ham-menu.active span:nth-child(2) { opacity: 0; }
.ham-menu.active span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

.off-screen-menu {
    position: fixed;
    top: 72px;
    right: 12px;
    left: 12px;
    max-width: 340px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
    z-index: 30;
}

.off-screen-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.off-screen-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.off-screen-menu a {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.off-screen-menu a:hover {
    background: var(--field);
    color: var(--primary);
}

/* =========================================================
   Layout / card
   ========================================================= */
.login-container {
    width: 100%;
    max-width: 920px;
}

.login-card {
    display: grid;
    grid-template-columns: 5fr 6fr;
    background: var(--surface);
    border-radius: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: rise 0.6s var(--ease) both;
}

/* ---------- Brand panel ---------- */
.login-brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    text-align: center;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(160deg, #1e1b4b 0%, #312e81 45%, #4f46e5 100%);
}

.login-brand::before,
.login-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.login-brand::before {
    width: 320px;
    height: 320px;
    top: -120px;
    left: -110px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.45), transparent 70%);
}

.login-brand::after {
    width: 380px;
    height: 380px;
    bottom: -170px;
    right: -120px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 70%);
}

.login-header {
    position: relative;
    z-index: 1;
}

.logo-badge {
    width: 128px;
    height: 128px;
    margin: 0 auto 24px;
    padding: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28), 0 0 0 8px rgba(255, 255, 255, 0.12);
}

.logo-badge img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-header h2 {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 1.05rem;
    opacity: 0.85;
}

/* ---------- Form panel ---------- */
.login-panel {
    padding: 48px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.panel-head {
    margin-bottom: 28px;
}

.panel-head h3 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
}

.panel-head p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.92rem;
}

/* =========================================================
   Form
   ========================================================= */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.88rem;
    font-weight: 600;
}

.form-group label small {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
}

.field-icon {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--muted);
    pointer-events: none;
    transition: color 0.2s var(--ease);
}

.input-wrapper:focus-within .field-icon {
    color: var(--primary);
}

.input-wrapper input,
.input-wrapper select {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0 46px;
    font: inherit;
    font-size: 15px;
    color: var(--text);
    background-color: var(--field);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

/* credentials are typed left-to-right but aligned with the RTL layout */
.input-wrapper input {
    direction: ltr;
    text-align: right;
}

.input-wrapper input::placeholder {
    color: #9aa5ba;
}

.input-wrapper input:hover,
.input-wrapper select:hover {
    border-color: #c5cce2;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    background-color: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--ring);
}

.input-wrapper input:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 40px var(--field) inset;
}

/* company dropdown */
.input-wrapper select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    background-size: 18px;
}

.input-wrapper select.is-placeholder {
    color: var(--muted);
}

.input-wrapper select option {
    color: var(--text);
}

/* password show / hide */
.password-toggle {
    position: absolute;
    top: 50%;
    left: 6px;
    width: 38px;
    height: 38px;
    margin-top: -19px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.password-toggle:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--primary);
}

.eye-icon {
    display: block;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.eye-icon.show-password {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24M1 1l22 22'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24M1 1l22 22'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Errors ---------- */
.alert {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
}

.alert.show {
    display: flex;
}

.alert::before {
    content: "";
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

.alert-error {
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    animation: shake 0.4s var(--ease);
}

.error-message {
    display: none;
    margin-top: 6px;
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 600;
}

.error-message.show {
    display: block;
}

.form-group.error input,
.form-group.error select {
    border-color: var(--danger);
    background-color: var(--danger-bg);
}

.form-group.error .input-wrapper:focus-within input,
.form-group.error .input-wrapper:focus-within select {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
}

/* ---------- Submit button ---------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 52px;
    padding: 0 24px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
    box-shadow: 0 10px 22px -8px rgba(79, 70, 229, 0.65);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s var(--ease);
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 14px 26px -8px rgba(79, 70, 229, 0.7);
}

.btn:active {
    transform: translateY(0);
}

.login-btn {
    width: 100%;
    margin-top: 8px;
}

.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.2s var(--ease);
}

.btn-text svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s var(--ease);
}

.btn:hover .btn-text svg {
    transform: translateX(-3px);
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: spin 0.8s linear infinite;
}

.btn.loading {
    pointer-events: none;
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading .btn-loader {
    opacity: 1;
}

/* ---------- Success state ---------- */
.success-message {
    display: none;
    padding: 40px 12px;
    text-align: center;
}

.success-message.show {
    display: block;
    animation: rise 0.5s var(--ease) both;
}

.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    color: #fff;
    background: #22c55e;
    border-radius: 50%;
    animation: pop 0.5s var(--ease) both;
}

.success-icon svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.success-message h3 {
    margin-bottom: 6px;
    font-size: 1.4rem;
}

.success-message p {
    color: var(--muted);
}

/* ---------- Footer ---------- */
.signup-link {
    margin-top: 22px;
    text-align: center;
}

.signup-link p {
    color: var(--muted);
    font-size: 0.82rem;
}

/* =========================================================
   Animations
   ========================================================= */
@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}

@keyframes pop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

/* =========================================================
   Responsive
   ========================================================= */

/* Desktop: quick links become inline pills, hamburger is hidden */
@media (min-width: 768px) {
    .topbar {
        justify-content: center;
        padding: 0 32px;
    }

    .ham-menu {
        display: none;
    }

    .off-screen-menu {
        position: static;
        max-width: none;
        padding: 0;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .off-screen-menu ul {
        flex-direction: row;
        gap: 6px;
    }

    .off-screen-menu a {
        padding: 8px 18px;
        border-radius: 999px;
        font-size: 0.9rem;
        color: var(--muted);
    }

    .off-screen-menu a:hover {
        background: rgba(79, 70, 229, 0.1);
        color: var(--primary);
    }
}

/* Tablet / phone: stack the card */
@media (max-width: 760px) {
    body {
        padding: 84px 14px 24px;
    }

    .login-card {
        grid-template-columns: 1fr;
        border-radius: 22px;
    }

    .login-brand {
        padding: 28px 20px;
    }

    .logo-badge {
        width: 88px;
        height: 88px;
        margin-bottom: 14px;
        padding: 14px;
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25), 0 0 0 6px rgba(255, 255, 255, 0.12);
    }

    .login-header h2 {
        font-size: 1.45rem;
        margin-bottom: 2px;
    }

    .login-header p {
        font-size: 0.95rem;
    }

    .login-panel {
        padding: 28px 22px 30px;
    }

    .panel-head {
        margin-bottom: 22px;
    }

    .panel-head h3 {
        font-size: 1.3rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
