/**
 * Login Page Styles — 2-Step Verification
 *
 * Mobile-first CSS for the B2B login page with 3 states.
 * Based on the approved prototype, with hardcoded values
 * (no dependency on base.css variables since login is standalone).
 *
 * @package Israel_Market_B2B
 * @since 1.0.0
 */

/* ==========================================================================
   Reset & Base (login page is standalone, no WP theme styles)
   ========================================================================== */

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

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--cs-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    line-height: 1.5;
    color: #262626;
    background: #fafafa;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--cs-black);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 1rem 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-logo {
    font-size: var(--cs-text-lg);
    font-weight: 700;
    color: var(--cs-black);
}

.site-logo img,
.site-logo svg {
    height: 24px;
    width: auto;
}

/* WordPress custom logo - normalize the nested link/img */
.site-logo .custom-logo-link {
    display: inline-flex;
    align-items: center;
}

.site-logo .custom-logo {
    height: 24px;
    width: auto;
}

.nav-text {
    color: #737373;
    font-size: var(--cs-text-sm);
    font-weight: 500;
}

/* ==========================================================================
   Login Page Layout
   ========================================================================== */

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
    overflow: hidden;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ==========================================================================
   Login Card
   ========================================================================== */

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    position: relative;
}

/* ==========================================================================
   Login States (show/hide)
   ========================================================================== */

.login-state {
    display: none;
}

.login-state.active {
    display: block;
}

/* ==========================================================================
   Login Header (per state)
   ========================================================================== */

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-header h1 {
    font-size: var(--cs-display-sm);
    font-weight: 700;
    color: var(--cs-black);
    margin-bottom: 0.5rem;
}

.login-header .subtitle {
    color: #737373;
    font-size: var(--cs-text);
    line-height: 1.6;
}

.state-icon {
    font-size: var(--cs-display);
    margin-bottom: 0.75rem;
    display: block;
}

/* ==========================================================================
   Login Form
   ========================================================================== */

.login-form {
    margin-bottom: 1.25rem;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-form .form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: var(--cs-text-sm);
    color: #404040;
}

.login-form .form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: var(--cs-text);
    color: #262626;
    background: #fafafa;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
    direction: ltr;
    text-align: left;
}

.login-form .form-input:focus {
    outline: none;
    border-color: #3d3d3b;
    box-shadow: 0 0 0 3px rgba(29, 29, 27, 0.12);
    background: #fff;
}

.login-form .form-input::placeholder {
    color: #a3a3a3;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: var(--cs-text);
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: all 150ms ease;
    text-decoration: none;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

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

.btn-primary {
    color: #fff;
    background: var(--cs-black);
    border-color: var(--cs-black);
}

.btn-primary:hover {
    color: #fff !important;
    background: #3d3d3b !important;
    border-color: #3d3d3b !important;
    box-shadow: 0 4px 12px rgba(29, 29, 27, 0.25);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    color: var(--cs-black);
    background: transparent;
    border-color: #d4d4d4;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: var(--cs-black);
}

.btn-lg {
    padding: 1rem 1.5rem;
    font-size: var(--cs-text);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-text svg {
    transition: transform 0.3s ease;
    transform: translateX(0);
}

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

/* Button loading state */
.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ==========================================================================
   Code Input (6-digit)
   ========================================================================== */

.code-form .code-inputs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    direction: ltr;
}

.code-digit {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: var(--cs-text-lg);
    font-weight: 600;
    color: var(--cs-black);
    background: #fff;
    border: 2px solid #d4d4d4;
    border-radius: 8px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
    font-family: inherit;
}

.code-digit:focus {
    outline: none;
    border-color: var(--cs-black);
    box-shadow: 0 0 0 3px rgba(29, 29, 27, 0.12);
}

.code-digit.has-value {
    border-color: var(--cs-black);
    background: #fafafa;
}

.code-digit.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.code-error {
    text-align: center;
    color: #ef4444;
    font-size: var(--cs-text-sm);
    margin-top: 0.75rem;
}

/* Shake animation for wrong code */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

.code-inputs.shake {
    animation: shake 0.5s ease;
}

/* ==========================================================================
   Login Help / Timer / Resend
   ========================================================================== */

.login-help {
    text-align: center;
    font-size: var(--cs-text-sm);
    color: #737373;
}

.login-help p {
    margin-bottom: 0.5rem;
}

.login-help a {
    color: var(--cs-black);
    font-weight: 500;
}

.login-help .timer {
    font-size: var(--cs-text-sm);
    color: #a3a3a3;
}

.resend-link {
    cursor: pointer;
}

.resend-link.disabled {
    pointer-events: none;
    opacity: 0.4;
}

/* ==========================================================================
   Back Button
   ========================================================================== */

.back-btn {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    color: #525252;
    font-size: var(--cs-text-sm);
    cursor: pointer;
    transition: all 150ms ease;
    font-family: inherit;
    text-align: center;
}

.back-btn:hover {
    background: #fafafa;
    border-color: #d4d4d4;
}

/* ==========================================================================
   Error State
   ========================================================================== */

.error-details {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.25rem;
    font-size: var(--cs-text-sm);
    color: #991b1b;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    background: #fff;
    border-top: 1px solid #e5e5e5;
    padding: 1.5rem 0;
    text-align: center;
}

.site-footer p {
    color: #737373;
    font-size: var(--cs-text-sm);
}

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

@media (min-width: 640px) {
    .login-card {
        padding: 2.5rem;
    }

    .login-header h1 {
        font-size: var(--cs-display-sm);
    }

    .code-digit {
        width: 52px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.5rem;
    }

    .login-header h1 {
        font-size: var(--cs-text-lg);
    }

    .code-digit {
        width: 42px;
        height: 48px;
        font-size: var(--cs-text-lg);
    }
}

/* ==========================================================================
   Photo background + brand panel (modelled on the CS On Track login)

   Scoped to .b2b-login-page: the theme's style.css carries an older copy of
   the login rules, and the scope keeps these ahead of it whatever the load
   order.
   ========================================================================== */

.b2b-login-page {
    background: #0e0f11;
}

.b2b-login-page .login-main {
    position: relative;
    isolation: isolate;
    padding: 3rem 0;
    min-height: calc(100vh - 57px);
}

/* The warehouse photo, darkened so the white card and the panel text carry */
.b2b-login-page .login-main::before,
.b2b-login-page .login-main::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
}

.b2b-login-page .login-main::before {
    background: url("../images/login-background.jpg") center 40% / cover no-repeat;
    filter: blur(3px) saturate(0.85);
    transform: scale(1.04); /* hides the blur's soft edge */
}

.b2b-login-page .login-main::after {
    background:
        radial-gradient(ellipse at center, rgba(14, 15, 17, 0.2) 0%, rgba(14, 15, 17, 0.7) 80%),
        linear-gradient(rgba(14, 15, 17, 0.3), rgba(14, 15, 17, 0.5));
}

.b2b-login-page .login-wrapper {
    max-width: 420px;
    display: flex;
    align-items: stretch;
}

.b2b-login-page .login-card {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 2px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* Brand panel */
.login-brand {
    display: none;
}

@media (min-width: 860px) {
    .b2b-login-page .login-wrapper {
        max-width: 880px;
        gap: 1.75rem;
    }

    .login-brand {
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex: 1 1 0;
        min-width: 0;
        padding: 2.5rem;
        color: #fff;
        background: rgba(20, 21, 24, 0.72);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 2px;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    }
}

.login-brand-eyebrow {
    align-self: flex-start;
    padding: 0.3rem 0.75rem;
    margin-bottom: 1.25rem;
    font-size: var(--cs-text-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
}

.login-brand-title {
    font-size: var(--cs-display-sm);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.875rem;
}

.login-brand-text {
    font-size: var(--cs-text);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.78);
    margin-bottom: 1.5rem;
}

.login-brand-points {
    list-style: none;
    display: grid;
    gap: 0.625rem;
    font-size: var(--cs-text-sm);
    color: rgba(255, 255, 255, 0.88);
}

.login-brand-points li {
    position: relative;
    padding-inline-start: 1.625rem;
}

/* Check mark drawn with borders, so no icon font or image is needed */
.login-brand-points li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0.25rem;
    top: 0.3em;
    width: 0.4rem;
    height: 0.75rem;
    border: solid rgba(255, 255, 255, 0.9);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@media (max-width: 480px) {
    .b2b-login-page .login-main {
        padding: 2rem 0;
    }
}
