/* ============================================================
   login.css
   - Purpose: Styling for the login/register/forgot page + modal
   - Notes:
     - Bootstrap is loaded globally, we only style the custom UI here
     - Keep selectors scoped to avoid bleeding into other pages
============================================================ */

/* ============================================================
   LOGIN THEME – XXL Sales House (scoped)
============================================================ */
.auth-login {
  --brand-surface: rgba(16, 24, 40, 0.62);
  --brand-border: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
  --text-muted: rgba(255, 255, 255, 0.68);
  --input-bg: rgba(255, 255, 255, 0.08);
  --input-border: rgba(255, 255, 255, 0.16);
  --input-border-focus: rgba(245, 199, 63, 0.85);
  --accent: #F5C73F;
  --accent-2: #FFB800;
  --danger: #FF4D6D;
  --success: #38D9A9;
  --btn-text: #0B1220;
}

/* ============================================================
   Base / Reset
============================================================ */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ============================================================
   Fullscreen background wrapper
============================================================ */
.login-page-wrapper {
    min-height: 100vh;
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 14px;
    padding: 16px;

    background-image: url("/img/webpage/login-bg.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ============================================================
   Glass card container
============================================================ */
.glass-card {
    max-width: 460px;
    width: 100%;

    padding: 34px 38px 30px;
    border-radius: 26px;

    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.32) 0%,
        rgba(255, 255, 255, 0.14) 100%
    );
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);

    border: 1px solid rgba(255, 255, 255, 0.50);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);

    color: #0f172a;
}

/* Brand-themed glass card for auth-login scope */
.auth-login .glass-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    color: var(--text);
}

/* ============================================================
   Animated alert stack (success/error/validation)
============================================================ */
.sb-alert-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.sb-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;

    padding: 12px 12px;
    border-radius: 16px;

    border: 1px solid rgba(148, 163, 184, 0.55);
    background: rgba(255, 255, 255, 0.85);

    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.14);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    animation: sb-pop-in 260ms ease-out both;
}

@keyframes sb-pop-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Auth login themed alerts */
.auth-login .sb-alert {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    color: var(--text);
}

.sb-alert i {
    font-size: 18px;
    line-height: 1.2;
    margin-top: 2px;
}

.sb-alert__text { flex: 1; }
.sb-alert__title { font-weight: 800; font-size: 13px; margin-bottom: 2px; }
.sb-alert__body { font-size: 12.5px; color: #111827; }

.auth-login .sb-alert__body { 
    color: var(--text-muted); 
}

.sb-alert__list {
    margin: 6px 0 0;
    padding-left: 16px;
}

.sb-alert--success {
    border-color: rgba(34, 197, 94, 0.35);
}

.auth-login .sb-alert--success {
    border-color: var(--success);
}

.auth-login .sb-alert--success i {
    color: var(--success);
}

.sb-alert--danger {
    border-color: rgba(239, 68, 68, 0.35);
}

.auth-login .sb-alert--danger {
    border-color: var(--danger);
}

.auth-login .sb-alert--danger i {
    color: var(--danger);
}

/* ============================================================
   Language selector
============================================================ */
.lang-select-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;
    margin-bottom: 14px;
}

.lang-select-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.90);
    border: 1px solid rgba(148, 163, 184, 0.70);
    color: #2A292A;
}

.lang-select {
    padding: 6px 12px;
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.70);
}

/* Auth login themed language selector */
.auth-login .lang-select-label {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text);
}

.auth-login .lang-select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text);
}

/* ============================================================
   Company logo
============================================================ */
.login-key-icon {
    width: 190px;
    max-width: 70vw;
    height: auto;

    display: block;
    margin: 6px auto 18px;
}

/* ============================================================
   Titles / headings
============================================================ */
.glass-card-header {
    text-align: center;
    margin-bottom: 18px;
}

.glass-card-title {
    font-size: 28px;
    font-weight: 800;
}

.glass-card-subtitle {
    font-size: 14px;
    color: #4b5563;
}

/* Auth login themed titles */
.auth-login .glass-card-title {
    color: var(--text);
}

.auth-login .glass-card-subtitle {
    color: var(--text-muted);
}

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

.form-label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: #374151;
}

/* Auth login themed labels */
.auth-login .form-label {
    color: var(--text-muted);
}

/* ============================================================
   Inputs (custom)
============================================================ */
.input-wrapper {
    position: relative;
}

.form-control-custom {
    width: 100%;
    padding: 10px 42px 10px 14px;

    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.75);
    background: rgba(255, 255, 255, 0.97);

    outline: none;
}

.form-control-custom:focus {
    border-color: rgba(131, 169, 167, 0.95);
    box-shadow: 0 0 0 0.2rem rgba(131, 169, 167, 0.20);
}

/* Auth login themed inputs */
.auth-login .form-control-custom {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text);
}

.auth-login .form-control-custom::placeholder {
    color: rgba(255,255,255,0.55);
}

.auth-login .form-control-custom:focus {
    outline: none;
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 3px rgba(245,199,63,0.18);
}

/* Input icon (right side) */
.input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
}

/* Auth login themed input icons */
.auth-login .input-icon {
    color: var(--text-muted);
}

/* ============================================================
   Inline field errors (under input)
============================================================ */
.error-text {
    font-size: 12px;
    color: #b91c1c;
    margin-top: 6px;
}

/* Auth login themed error text */
.auth-login .error-text {
    color: var(--danger);
}

/* Auth login themed invalid inputs */
.auth-login .is-invalid,
.auth-login input[aria-invalid="true"] {
    border-color: rgba(255,77,109,0.85) !important;
    box-shadow: 0 0 0 3px rgba(255,77,109,0.16) !important;
}

/* Auth login themed info button */
.auth-login .btn-link.text-dark {
    color: var(--text) !important;
}

/* ============================================================
   Remember row
============================================================ */
.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;

    font-size: 13px;
    margin-bottom: 16px;
}

/* Auth login themed remember row */
.auth-login .remember-row {
    color: var(--text-muted);
}

.auth-login .remember-row input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ============================================================
   Divider (requested)
============================================================ */
.sb-divider {
    height: 1px;
    width: 100%;
    margin: 10px 0 16px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(148, 163, 184, 0.0),
        rgba(148, 163, 184, 0.7),
        rgba(148, 163, 184, 0.0)
    );
}

/* ============================================================
   Primary button (SafeBox palette)
============================================================ */
.btn-login {
    width: 100%;
    padding: 12px 18px;

    border-radius: 999px;
    border: none;

    font-size: 16px;
    font-weight: 700;

    color: #fff;
    cursor: pointer;

    background-image: linear-gradient(90deg, #83A9A7, #912461);
    transition: transform 0.08s ease, filter 0.2s ease;
}

.btn-login:hover {
    filter: brightness(1.05);
}

.btn-login:active {
    transform: translateY(1px);
}

/* Auth login themed primary button */
.auth-login .btn-login {
    background: linear-gradient(135deg, rgba(245,199,63,0.95), rgba(255,184,0,0.92));
    color: var(--btn-text);
    border: 1px solid rgba(255,255,255,0.12);
}

.auth-login .btn-login:hover {
    filter: brightness(1.05);
    box-shadow: 0 10px 24px rgba(245,199,63,0.18);
}

.auth-login .btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================
   Link-like buttons
============================================================ */
.btn-link-like {
    background: transparent;
    border: none;
    padding: 0;

    color: #912461;
    font-weight: 600;
    text-decoration: underline;

    cursor: pointer;
}

/* Footer helper text */
.bottom-text {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
}

.bottom-text a {
    color: #912461;
    text-decoration: underline;
}

/* Auth login themed links */
.auth-login .btn-link-like {
    color: var(--accent);
}

.auth-login .btn-link-like:hover {
    color: var(--accent-2);
    text-decoration: underline;
}

.auth-login .bottom-text {
    color: var(--text-muted);
}

.auth-login .bottom-text a {
    color: var(--accent);
}

/* ============================================================
   Security footer (requested)
============================================================ */
.sb-security-footer {
    max-width: 460px;
    width: 100%;

    padding: 14px 16px;
    border-radius: 22px;

    background: rgba(255, 255, 255, 0.70);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    color: #0f172a;
}

.sb-security-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.sb-security-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.90);
    border: 1px solid rgba(148, 163, 184, 0.55);
}

.sb-security-icon i {
    font-size: 16px;
}

.sb-security-title {
    font-weight: 800;
    font-size: 13px;
    margin-bottom: 2px;
}

.sb-security-body {
    font-size: 12.5px;
    color: #111827;
}

.sb-legal-links {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
}

.sb-legal-link {
    color: #912461;
    text-decoration: underline;
    font-weight: 600;
}

.sb-legal-sep {
    margin: 0 6px;
    color: rgba(17, 24, 39, 0.45);
}

/* ============================================================
   Responsive adjustments
============================================================ */
@media (max-width: 480px) {
    .glass-card {
        padding: 22px 18px 20px;
    }

    .glass-card-title {
        font-size: 24px;
    }

    .login-key-icon {
        width: 104px;
    }
}

/* ============================================================
   Bootstrap modal styling (glass look)
============================================================ */
.glass-modal .modal-content {
    border-radius: 26px;
    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);

    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.30) 0%,
        rgba(255, 255, 255, 0.12) 100%
    );

    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);

    color: #0f172a;
}

/* Override for auth-login scope to use light text */
.auth-login .glass-modal .modal-content {
    color: var(--text);
}

.glass-modal .modal-header,
.glass-modal .modal-footer {
    border-color: rgba(255, 255, 255, 0.25);
}

.glass-modal .modal-title {
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* Override for auth-login scope to use light text */
.auth-login .glass-modal .modal-title {
    color: var(--text);
}

.glass-modal .btn-close {
    filter: invert(1);
    opacity: 0.8;
}

.glass-modal .btn-close:hover {
    opacity: 1;
}

.glass-modal .modal-body p {
    margin-bottom: 12px;
    color: #111827;
}

/* Override for auth-login scope to use light text */
.auth-login .glass-modal .modal-body p {
    color: var(--text-muted);
}

/* Ensure links in auth-login modals are readable */
.auth-login .glass-modal a {
    color: var(--accent);
}

.auth-login .glass-modal a:hover {
    opacity: 0.9;
}

.glass-modal-logo {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 16px;

    background: rgba(255, 255, 255, 0.70);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.btn-glass-secondary {
    border-radius: 999px;
    padding: 10px 18px;

    font-weight: 600;

    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.70);
    color: #111827;
}

.btn-glass-secondary:hover {
    background: rgba(255, 255, 255, 0.95);
}

.modal-backdrop.show {
    opacity: 0.55;
}

/* ============================================================
   Bootstrap modal mobile scroll fix (login page)
   Keep consistent with partnerpage.css
============================================================ */

@media (max-width: 575.98px){
    .modal-dialog{
        margin: .5rem;
        max-height: calc(100dvh - 1rem);
    }

    .modal-content{
        max-height: calc(100dvh - 1rem);
    }

    .modal-dialog-scrollable{
        height: calc(100dvh - 1rem);
    }

    .modal-dialog-scrollable .modal-content{
        max-height: calc(100dvh - 1rem);
    }

    .modal-dialog-scrollable .modal-body{
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /*
      iOS Safari fix:
      If a modal has a <form> wrapper between .modal-content and .modal-body,
      the scrollable body can fail to scroll. Ensure the direct child form is a
      flex column and allow the body to shrink (min-height: 0) so overflow works.
    */
    .modal-dialog-scrollable .modal-content > form{
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
    }

    .modal-dialog-scrollable .modal-content > form .modal-body{
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Fallback for modals that are not using modal-dialog-scrollable */
    .modal .modal-body{
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================================
   Autocomplete panel (ZIP/City suggestions)
============================================================ */
.autocomplete-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;

    border-radius: 14px;
    overflow: hidden;

    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.55);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 12px;
    font-size: 13px;

    cursor: pointer;
}

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

.autocomplete-item .muted {
    color: #64748b;
    font-size: 12px;
}

.autocomplete-empty {
    padding: 10px 12px;
    font-size: 13px;
    color: #64748b;
}
