/* Login page polish (login_1.php). Everything is scoped under body.login-v2. */

body.login-v2 {
    --lg-brand: #ef4f3c;
    --lg-brand-dark: #d93a28;
    --lg-ink: #1f2433;
    --lg-muted: #6b7280;
    --lg-line: #e5e7eb;
    --lg-field: #f8f9fb;
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(160deg, #fff5f3 0%, #f6f7fb 55%, #eef1f8 100%) fixed;
    color: var(--lg-ink);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-x: hidden;
}

/* decorative blurred blobs */
body.login-v2::before,
body.login-v2::after {
    content: "";
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
}
body.login-v2::before {
    width: 420px; height: 420px;
    top: -140px; inset-inline-start: -120px;
    background: rgba(239, 79, 60, 0.18);
}
body.login-v2::after {
    width: 380px; height: 380px;
    bottom: -140px; inset-inline-end: -100px;
    background: rgba(68, 81, 107, 0.16);
}

/* decorative business icons (receipt, cart, stock, cash, charts...) */
.login-v2 .login-bg-icons {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.login-v2 .login-bg-icons i {
    --r: 0deg;
    position: absolute;
    font-size: 40px;
    line-height: 1;
    color: rgba(239, 79, 60, 0.11);
    transform: rotate(var(--r));
    animation: lgFloat 11s ease-in-out infinite;
}
.login-v2 .login-bg-icons i:nth-child(even) {
    color: rgba(68, 81, 107, 0.11);
}
/*            position                     size              tilt         timing */
.login-v2 .login-bg-icons i:nth-child(1)  { top: 9%;  left: 7%;   font-size: 52px; --r: -12deg; animation-duration: 12s; }
.login-v2 .login-bg-icons i:nth-child(2)  { top: 13%; right: 9%;  font-size: 46px; --r: 10deg;  animation-delay: -2s; }
.login-v2 .login-bg-icons i:nth-child(3)  { top: 36%; left: 4%;   font-size: 38px; --r: 8deg;   animation-duration: 9s;  animation-delay: -4s; }
.login-v2 .login-bg-icons i:nth-child(4)  { top: 40%; right: 5%;  font-size: 54px; --r: -8deg;  animation-duration: 13s; animation-delay: -1s; }
.login-v2 .login-bg-icons i:nth-child(5)  { top: 66%; left: 9%;   font-size: 48px; --r: -6deg;  animation-delay: -6s; }
.login-v2 .login-bg-icons i:nth-child(6)  { top: 70%; right: 10%; font-size: 40px; --r: 12deg;  animation-duration: 10s; animation-delay: -3s; }
.login-v2 .login-bg-icons i:nth-child(7)  { top: 4%;  left: 30%;  font-size: 30px; --r: 14deg;  animation-duration: 14s; animation-delay: -5s; }
.login-v2 .login-bg-icons i:nth-child(8)  { top: 6%;  right: 28%; font-size: 32px; --r: -10deg; animation-duration: 9s;  animation-delay: -7s; }
.login-v2 .login-bg-icons i:nth-child(9)  { bottom: 8%; left: 26%; font-size: 34px; --r: 6deg; animation-duration: 12s; animation-delay: -8s; }
.login-v2 .login-bg-icons i:nth-child(10) { bottom: 12%; right: 24%; font-size: 30px; --r: -14deg; animation-delay: -9s; }
.login-v2 .login-bg-icons i:nth-child(11) { top: 22%; left: 18%;  font-size: 28px; --r: -18deg; animation-duration: 10s; animation-delay: -2s; }
.login-v2 .login-bg-icons i:nth-child(12) { top: 54%; right: 18%; font-size: 30px; --r: 16deg;  animation-duration: 13s; animation-delay: -6s; }

@keyframes lgFloat {
    0%, 100% { transform: translateY(0) rotate(var(--r)); }
    50%      { transform: translateY(-10px) rotate(calc(var(--r) + 4deg)); }
}

/* ---------- layout ---------- */
.login-v2 .login-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 16px 0;
}
.login-v2 .login-main {
    width: 100%;
    max-width: 440px;
    margin: auto 0;
}

/* ---------- language chips ---------- */
.login-v2 .login-lang-toggle {
    position: absolute;
    top: 14px;
    inset-inline-end: 16px;
    z-index: 5;
    display: flex;
    gap: 6px;
}
.login-v2 .login-lang-toggle a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--lg-line);
    color: var(--lg-ink);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(16, 24, 40, 0.05);
    transition: border-color .2s, color .2s, box-shadow .2s;
}
.login-v2 .login-lang-toggle a:hover {
    border-color: var(--lg-brand);
    color: var(--lg-brand);
    box-shadow: 0 4px 12px rgba(239, 79, 60, 0.15);
}

/* ---------- card ---------- */
.login-v2 .login-card {
    background: #fff;
    border: 1px solid rgba(17, 24, 39, 0.06);
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04),
                0 12px 32px -8px rgba(16, 24, 40, 0.12),
                0 32px 64px -24px rgba(239, 79, 60, 0.12);
    padding: 36px 36px 28px;
    animation: lgCardIn .55s cubic-bezier(.2, .8, .2, 1) both;
}
.login-v2 .login-brand {
    text-align: center;
    margin-bottom: 22px;
}
.login-v2 .login-brand img {
    max-height: 150px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
}
.login-v2 .login-title {
    margin: 16px 0 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--lg-ink);
}
.login-v2 .login-title::after {
    content: "";
    display: block;
    width: 36px;
    height: 3px;
    margin: 10px auto 0;
    border-radius: 3px;
    background: var(--lg-brand);
}

/* ---------- fields ---------- */
.login-v2 .login-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}
.login-v2 .login-field {
    position: relative;
}
.login-v2 .login-field > .bi {
    position: absolute;
    top: 50%;
    inset-inline-start: 14px;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 17px;
    pointer-events: none;
    transition: color .2s;
}
.login-v2 .login-field .form-control {
    height: 48px;
    padding-inline-start: 42px;
    padding-inline-end: 14px;
    border-radius: 12px;
    border: 1px solid var(--lg-line);
    background: var(--lg-field);
    font-size: 15px;
    color: var(--lg-ink);
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.login-v2 .login-field.has-toggle .form-control {
    padding-inline-end: 46px;
}
.login-v2 .login-field .form-control::placeholder {
    color: #a3a9b5;
}
.login-v2 .login-field .form-control:hover {
    border-color: #d1d5db;
}
.login-v2 .login-field .form-control:focus {
    background: #fff;
    border-color: var(--lg-brand);
    box-shadow: 0 0 0 4px rgba(239, 79, 60, 0.15);
    outline: none;
}
.login-v2 .login-field:focus-within > .bi {
    color: var(--lg-brand);
}
.login-v2 .login-field .form-control.red_border {
    border-color: #dc3545;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.14);
    animation: lgShake .35s ease-in-out;
}

.login-v2 .login-pass-toggle {
    position: absolute;
    top: 50%;
    inset-inline-end: 6px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #9ca3af;
    font-size: 17px;
    cursor: pointer;
    transition: color .2s, background-color .2s;
}
.login-v2 .login-pass-toggle:hover,
.login-v2 .login-pass-toggle:focus-visible {
    color: var(--lg-ink);
    background: #eef0f4;
    outline: none;
}

/* ---------- submit ---------- */
.login-v2 .login-submit {
    position: relative;
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--lg-brand) 0%, var(--lg-brand-dark) 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .01em;
    box-shadow: 0 8px 18px -6px rgba(239, 79, 60, 0.55);
    transition: transform .15s, box-shadow .2s, filter .2s, opacity .2s;
}
.login-v2 .login-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 12px 24px -8px rgba(239, 79, 60, 0.6);
}
.login-v2 .login-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 10px -4px rgba(239, 79, 60, 0.6);
}
.login-v2 .login-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(239, 79, 60, 0.25);
}
.login-v2 .login-submit:disabled {
    opacity: .65;
    cursor: not-allowed;
}
.login-v2 .login-submit .spinner-border {
    display: none;
    width: 1.1rem;
    height: 1.1rem;
    border-width: .16em;
    margin-inline-end: 8px;
    vertical-align: -3px;
}
.login-v2 .login-submit.is-loading .spinner-border {
    display: inline-block;
}

.login-v2 .login-turnstile {
    display: flex;
    justify-content: center;
    min-height: 0;
}

/* ---------- website link ---------- */
.login-v2 .login-website {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    padding: 12px 14px;
    border: 1px dashed #f3c0b9;
    border-radius: 12px;
    background: #fff8f6;
    color: var(--lg-ink);
    text-decoration: none;
    transition: border-color .2s, background-color .2s, transform .15s;
}
.login-v2 .login-website:hover {
    border-style: solid;
    border-color: var(--lg-brand);
    background: #fff1ee;
    color: var(--lg-ink);
}
.login-v2 .login-website-icon {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(239, 79, 60, 0.12);
    color: var(--lg-brand);
    font-size: 18px;
}
.login-v2 .login-website-text {
    flex: 1;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--lg-muted);
}
.login-v2 .login-website-text b:first-child {
    display: block;
    font-size: 13.5px;
    color: var(--lg-ink);
}
.login-v2 .login-website-arrow {
    color: var(--lg-brand);
    transition: transform .2s;
}
.login-v2 .login-website:hover .login-website-arrow {
    transform: translateX(3px);
}
.login-v2.rtl .login-website-arrow {
    transform: scaleX(-1);
}
.login-v2.rtl .login-website:hover .login-website-arrow {
    transform: scaleX(-1) translateX(3px);
}

/* hidden mobile-app promo (kept for when it is re-enabled) */
.login-v2 .app-promo {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--lg-line);
}
.login-v2 .app-promo-icon {
    font-size: 34px;
    color: #3ddc84;
}

/* ---------- footer ---------- */
.login-v2 .login-footer {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 28px 12px 18px;
}
.login-v2 .login-footer-bar {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 16px;
    max-width: 100%;
    padding: 10px 20px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(17, 24, 39, 0.07);
    box-shadow: 0 6px 18px -10px rgba(16, 24, 40, 0.18);
    font-size: 12.5px;
    line-height: 1.4;
    color: #6b7280;
    animation: lgCardIn .55s .2s cubic-bezier(.2, .8, .2, 1) both;
}
.login-v2 .login-footer-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-align: start;
}
.login-v2 .login-footer-item > .bi {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(239, 79, 60, 0.1);
    color: var(--lg-brand);
    font-size: 12.5px;
}
.login-v2 .login-footer-sep {
    width: 1px;
    height: 18px;
    background: rgba(17, 24, 39, 0.12);
}
.login-v2 .login-footer b {
    color: var(--lg-ink);
    font-weight: 700;
    letter-spacing: .04em;
}
.login-v2 .login-footer a {
    color: var(--lg-brand);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed rgba(239, 79, 60, 0.4);
    transition: border-color .2s, color .2s;
}
.login-v2 .login-footer a:hover {
    color: var(--lg-brand-dark);
    border-bottom-style: solid;
    border-bottom-color: var(--lg-brand-dark);
}
.login-v2 .login-footer p {
    margin: 0;
}

/* ---------- animations ---------- */
@keyframes lgCardIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes lgShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) {
    .login-v2 .login-card,
    .login-v2 .login-footer-bar,
    .login-v2 .login-bg-icons i,
    .login-v2 .login-field .form-control.red_border {
        animation: none;
    }
    .login-v2 .login-submit,
    .login-v2 .login-website-arrow {
        transition: none;
    }
}

/* ---------- small screens ---------- */
@media (max-width: 768px) {
    .login-v2 .login-bg-icons i:nth-child(n+6) {
        display: none;
    }
    .login-v2 .login-bg-icons i {
        font-size: 30px !important;
    }
}
@media (max-width: 480px) {
    .login-v2 .login-bg-icons {
        display: none;
    }
    body.login-v2::before,
    body.login-v2::after {
        display: none;
    }
    .login-v2 .login-shell {
        padding: 52px 12px 0;
    }
    .login-v2 .login-card {
        padding: 26px 20px 22px;
        border-radius: 16px;
    }
    .login-v2 .login-brand img {
        max-height: 110px;
    }
    .login-v2 .login-footer-bar {
        flex-direction: column;
        gap: 8px;
        border-radius: 16px;
        padding: 12px 16px;
    }
    .login-v2 .login-footer-sep {
        display: none;
    }
}

/* =====================================================================
   Fit-to-screen: sizes scale with the viewport height so the whole page
   fits without scrolling. Scrolling is only allowed on very short
   screens (e.g. landscape phones) so the form is never cut off.
   ===================================================================== */
.login-v2 .login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    /* room for the AI pill / language chips at the top */
    padding: clamp(48px, 7vh, 64px) 16px 0;
}
.login-v2 .login-card {
    padding: clamp(18px, 3.6vh, 36px) clamp(18px, 5vw, 36px) clamp(16px, 3vh, 28px);
}
.login-v2 .login-brand {
    margin-bottom: clamp(12px, 2.4vh, 22px);
}
.login-v2 .login-brand img {
    max-height: clamp(64px, 17vh, 160px);
}
.login-v2 .login-title {
    margin-top: clamp(6px, 1.4vh, 16px);
    font-size: clamp(1.1rem, 2.6vh, 1.35rem);
}
.login-v2 .login-title::after {
    margin-top: clamp(6px, 1.2vh, 10px);
}
.login-v2 #loginform .mb-3 {
    margin-bottom: clamp(10px, 2vh, 16px) !important;
}
.login-v2 #loginform .mb-4 {
    margin-bottom: clamp(14px, 2.8vh, 24px) !important;
}
.login-v2 .login-field .form-control,
.login-v2 .login-submit {
    height: clamp(42px, 6.2vh, 48px);
}
.login-v2 .login-website {
    margin-top: clamp(12px, 2.4vh, 22px);
    padding: clamp(8px, 1.4vh, 12px) 14px;
}
.login-v2 .login-website-title {
    display: block;
    font-size: 13.5px;
    color: var(--lg-ink);
}
.login-v2 .login-footer {
    padding: clamp(10px, 2.5vh, 28px) 12px clamp(8px, 1.6vh, 18px);
}

/* no page scroll whenever there is enough height for everything */
@media (min-height: 560px) {
    body.login-v2 {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
    .login-v2 .login-shell {
        height: 100%;
        min-height: 0;
    }
}

/* shorter screens: drop the least important pieces */
@media (max-height: 640px) {
    .login-v2 .login-website-sub,
    .login-v2 .login-title::after,
    .login-v2 .login-footer-item > .bi {
        display: none;
    }
    .login-v2 .login-website-icon {
        flex-basis: 30px;
        width: 30px;
        height: 30px;
        font-size: 15px;
    }
}

/* phones */
@media (max-width: 480px) {
    /* 16px stops iOS from zooming in when a field is focused */
    .login-v2 .login-field .form-control {
        font-size: 16px;
    }
    .login-v2 .login-footer-bar {
        gap: 4px;
        padding: 8px 14px;
        font-size: 11.5px;
    }
    .login-v2 .login-lang-toggle a {
        padding: 4px 11px;
        font-size: 12px;
    }
}

/* wide desktops: a touch more room */
@media (min-width: 1600px) and (min-height: 900px) {
    .login-v2 .login-main {
        max-width: 460px;
    }
}

/* sparkle used by the AI product tab (login-promo.css) */
@keyframes lgSparkle {
    0%, 100% { opacity: 1;  transform: scale(1); }
    50%      { opacity: .6; transform: scale(.85); }
}

/* phones: language chips a little tighter to the corner */
@media (max-width: 480px) {
    .login-v2 .login-lang-toggle {
        top: 12px;
        inset-inline-end: 12px;
    }
}
