/* Create Account Modal Styles */
.create-account-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100002; /* Must be above #mainHeader (99997) and mobile menu (99999) */
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    overflow: hidden;
}

    .create-account-modal-overlay.show {
        display: flex;
    }

.create-account-modal {
    position: relative;
    width: 552px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden; /* header stays fixed, body scrolls */
    display: none;
    flex-direction: column;
    background: var(--Colors-Gray-White, white);
    border-radius: 24px;
    box-shadow: 0px 20px 60px rgba(0, 0, 0, 0.3);
}

/* Sticky close-button header */
.create-account-modal-header {
    flex-shrink: 0;
    position: relative;
    width: 100%;
    background: var(--Colors-Gray-White, white);
    border-radius: 24px 24px 0 0;
    padding: 16px 16px 0 16px;
    box-sizing: border-box;
    z-index: 10;
}

    /* Hide scrollbar for Chrome, Safari and Opera */
    .create-account-modal::-webkit-scrollbar {
        display: none;
    }

/* Hide scrollbar for IE, Edge and Firefox */
.create-account-modal,
.create-account-container {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera on container */
.create-account-container::-webkit-scrollbar {
    display: none;
}

    .create-account-modal.show {
        display: flex;
    }

.create-account-modal-close {
    position: relative;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

[dir="rtl"] .create-account-modal-header {
    display: flex;
    justify-content: flex-end;
}

[dir="ltr"] .create-account-modal-header {
    display: flex;
    justify-content: flex-start;
}

/* Create Account Styles */
.create-account-container {
    width: 100%;
    padding: 8px 24px 24px 24px;
    position: relative;
    background: var(--Colors-Gray-White, white);
    border-radius: 0 0 24px 24px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 24px;
    display: inline-flex;
    box-sizing: border-box;
    overflow-y: auto; /* only body scrolls */
    overflow-x: hidden;
    flex: 1;
}

.create-account-header {
    align-self: stretch;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    display: flex;
    margin-top: 0;
    padding-top: 0;
}

.create-account-icon {
    width: 80px;
    height: 80px;
    background: var(--Primary-50, #F3F2F6);
    border-radius: 40px;
    justify-content: center;
    align-items: center;
    gap: 8px;
    display: inline-flex;
    overflow: visible;
    position: relative;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.create-account-icon-svg {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

    .create-account-icon-svg svg {
        display: block;
        width: 32px;
        height: 32px;
        visibility: visible;
        opacity: 1;
    }

.create-account-title {
    align-self: stretch;
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
    text-align: center;
    color: var(--Colors-Gray-Darkest, #111111);
    font-size: 24px;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 700;
    word-wrap: break-word;
}

[dir="ltr"] .create-account-title {
    font-family: 'Cairo', sans-serif;
}

.create-account-text-field {
    align-self: stretch;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    display: flex;
}

.create-account-text-field-with-height {
    align-self: stretch;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    display: flex;
}

.create-account-label {
    align-self: stretch;
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
    text-align: right;
    justify-content: center;
    display: flex;
    flex-direction: column;
    color: var(--Colors-Gray-Dark, #666666);
    font-size: 16px;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 500;
    word-wrap: break-word;
}

[dir="ltr"] .create-account-label {
    text-align: left;
    font-family: 'Cairo', sans-serif;
}

.create-account-field {
    align-self: stretch;
    padding: 16px;
    background: var(--Colors-Gray-White, white);
    overflow: hidden;
    border-radius: 12px;
    outline: 1px var(--Colors-Gray-Lighter, #E6E6E6) solid;
    outline-offset: -1px;
    justify-content: center;
    align-items: center;
    gap: 8px;
    display: inline-flex;
    flex-direction: row-reverse;
}

[dir="ltr"] .create-account-field {
    flex-direction: row;
}

.create-account-placeholder {
    flex: 1 1 0;
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
    text-align: right;
    justify-content: center;
    display: flex;
    flex-direction: column;
    color: var(--Colors-Gray-Default, #999999);
    font-size: 16px;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 500;
    word-wrap: break-word;
}

.create-account-placeholder-small {
    flex: 1 1 0;
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
    text-align: right;
    justify-content: center;
    display: flex;
    flex-direction: column;
    color: var(--Colors-Gray-Default, #999999);
    font-size: 14px;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 500;
    word-wrap: break-word;
}

[dir="ltr"] .create-account-placeholder,
[dir="ltr"] .create-account-placeholder-small {
    text-align: left;
    font-family: 'Cairo', sans-serif;
}

.create-account-field-icon {
    position: relative;
}

.create-account-input {
    flex: 1 1 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--Colors-Gray-Darkest, #111111);
    font-size: 14px;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 500;
    width: 100%;
    text-align: right;
    direction: rtl;
}

[dir="ltr"] .create-account-input {
    text-align: left;
    direction: ltr;
    font-family: 'Cairo', sans-serif;
}

.create-account-input::placeholder {
    color: var(--Colors-Gray-Default, #999999);
}

.create-account-button {
    cursor: pointer;
    border: none;
}

    .create-account-button:hover {
        opacity: 0.9;
    }

    .create-account-button:active {
        opacity: 0.8;
    }

#createAccountForm {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.create-account-text-field .text-danger,
.create-account-password-field .text-danger {
    align-self: stretch;
    font-size: 12px;
    color: #dc3545;
    margin-top: 4px;
    text-align: right;
}

[dir="ltr"] .create-account-text-field .text-danger,
[dir="ltr"] .create-account-password-field .text-danger {
    text-align: left;
}

.create-account-password-field {
    align-self: stretch;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    display: flex;
}

@keyframes aq-login-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.create-account-button {
    align-self: stretch;
    height: 64px;
    padding-left: 16px;
    padding-right: 16px;
    background: var(--Primary-500, #6A5D8B);
    border-radius: 16px;
    justify-content: center;
    align-items: center;
    display: inline-flex;
    position: relative;
    overflow: visible;
}

.create-account-button.is-loading {
    pointer-events: none;
    opacity: 0.92;
}

.create-account-button.is-loading .create-account-button-text {
    visibility: hidden;
}

.create-account-button.is-loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1.35rem;
    height: 1.35rem;
    margin: -0.675rem 0 0 -0.675rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: aq-login-btn-spin 0.65s linear infinite;
}

.create-account-button-text {
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
    text-align: right;
    color: var(--Colors-Gray-White, white);
    font-size: 20px;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 700;
    word-wrap: break-word;
}

[dir="ltr"] .create-account-button-text {
    text-align: left;
    font-family: 'Cairo', sans-serif;
}

.create-account-footer {
    width: 100%;
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
    text-align: center;
}

.create-account-footer-text {
    color: var(--Colors-Gray-Dark, #666666);
    font-size: 16px;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 500;
    word-wrap: break-word;
}

[dir="ltr"] .create-account-footer-text {
    font-family: 'Cairo', sans-serif;
}

.create-account-footer-link {
    color: var(--Primary-500, #6A5D8B);
    font-size: 16px;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 700;
    word-wrap: break-word;
    cursor: pointer;
}

[dir="ltr"] .create-account-footer-link {
    font-family: 'Cairo', sans-serif;
}

.create-account-footer-link:hover {
    text-decoration: underline;
}

.create-account-general-error {
    align-self: stretch;
    padding: 12px 16px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: #dc3545;
    font-size: 14px;
    text-align: center;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 500;
    word-wrap: break-word;
    margin: 0;
}

[dir="ltr"] .create-account-general-error {
    text-align: center;
    font-family: 'Cairo', sans-serif;
}

.create-account-accept-terms {
    align-self: stretch;
    margin-top: 4px;
    margin-bottom: 4px;
}

.create-account-accept-terms-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.45;
    color: var(--Colors-Gray-Darkest, #111111);
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    font-weight: 500;
}

[dir="ltr"] .create-account-accept-terms-label {
    font-family: 'Cairo', sans-serif;
}

.create-account-accept-terms-checkbox {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--Primary-500, #6A5D8B);
}

.create-account-accept-terms-text {
    flex: 1;
}

.create-account-terms-link {
    color: var(--Primary-500, #6A5D8B);
    text-decoration: underline;
}

.create-account-accept-terms-validation {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}

.create-account-open-terms-btn {
    align-self: flex-start;
    margin-bottom: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--Primary-500, #6A5D8B);
    background: var(--Colors-Gray-White, white);
    color: var(--Primary-500, #6A5D8B);
    font-size: 13px;
    font-weight: 600;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    cursor: pointer;
}

[dir="ltr"] .create-account-open-terms-btn {
    font-family: 'Cairo', sans-serif;
}

.create-account-open-terms-btn:hover {
    background: rgba(106, 93, 139, 0.08);
}

.create-account-accept-terms-checkbox:disabled + .create-account-accept-terms-text {
    opacity: 0.55;
}

.terms-read-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100005;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.55);
    padding: 16px;
    box-sizing: border-box;
}

.terms-read-modal-overlay.show {
    display: flex;
}

.terms-read-modal {
    display: flex;
    flex-direction: column;
    width: min(640px, 100%);
    max-height: min(90vh, 900px);
    min-height: 0;
    background: var(--Colors-Gray-White, white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.terms-read-modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--Colors-Gray-Lighter, #E6E6E6);
}

.terms-read-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--Colors-Gray-Darkest, #111111);
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
}

[dir="ltr"] .terms-read-modal-title {
    font-family: 'Cairo', sans-serif;
}

.terms-read-modal-close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    padding: 4px;
    cursor: pointer;
    color: var(--Colors-Gray-Darkest, #111111);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* iOS Safari: flex item must shrink (1 1 0%) so overflow-y scroll gets a real height */
.terms-read-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y pinch-zoom;
    background: #f5f5f5;
}

/* PDF.js canvas (no text layer): discourages copy/paste vs built-in PDF iframe viewer */
.terms-pdf-viewer {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    gap: 0;
    padding: 12px;
    min-height: min(55vh, 480px);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* Let vertical pans scroll the modal body on iOS (avoid gesture conflicts) */
    touch-action: pan-y pinch-zoom;
}

.terms-pdf-embed-wrap {
    flex: 1;
    min-height: 200px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    border-radius: 12px;
    background: #525659;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.terms-pdf-canvas-host {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    min-height: 280px;
}

.terms-pdf-page-canvas {
    display: block;
    box-sizing: border-box;
    max-width: 100%;
    width: auto;
    height: auto;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Full-page Terms / Privacy (Client): caption under page title */
.terms-pdf-page-view-only-hint {
    font-size: 15px;
    font-weight: 500;
    margin-top: 0.25rem;
}

[dir="ltr"] .terms-pdf-page-view-only-hint {
    font-family: 'Cairo', sans-serif;
}

[dir="rtl"] .terms-pdf-page-view-only-hint {
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
}

/* Full-page Terms / Privacy (Client) */
.terms-pdf-page-shell .terms-pdf-viewer {
    min-height: min(70vh, 800px);
}

.terms-pdf-page-shell .terms-pdf-canvas-host {
    min-height: min(70vh, 800px);
}

.terms-read-modal-footer {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    padding: 12px 16px;
    border-top: 1px solid var(--Colors-Gray-Lighter, #E6E6E6);
}

[dir="rtl"] .terms-read-modal-footer {
    justify-content: flex-start;
}

.terms-read-modal-btn {
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    border: none;
}

[dir="ltr"] .terms-read-modal-btn {
    font-family: 'Cairo', sans-serif;
}

.terms-read-modal-btn-secondary {
    background: var(--Colors-Gray-White, white);
    color: var(--Colors-Gray-Darkest, #111111);
    border: 1px solid var(--Colors-Gray-Lighter, #E6E6E6);
}

.terms-read-modal-btn-primary {
    background: var(--Primary-500, #6A5D8B);
    color: var(--Colors-Gray-White, white);
}

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    .create-account-modal {
        width: 95vw;
        max-height: 90vh;
        border-radius: 16px;
    }

    .create-account-container {
        padding: 24px 20px;
        gap: 6px;
    }

    .create-account-header {
        gap: 8px;
    }

    .create-account-icon {
        width: 64px;
        height: 64px;
        border-radius: 32px;
    }

    .create-account-icon-svg {
        width: 24px;
        height: 24px;
    }

        .create-account-icon-svg svg {
            width: 24px;
            height: 24px;
        }

    .create-account-title {
        font-size: 20px;
    }

    .create-account-text-field,
    .create-account-text-field-with-height,
    .create-account-password-field {
        gap: 5px;
    }

    .create-account-label {
        font-size: 14px;
    }

    .create-account-field {
        padding: 10px 14px;
        border-radius: 10px;
    }

    .create-account-input {
        font-size: 14px;
    }

    .create-account-placeholder,
    .create-account-placeholder-small {
        font-size: 14px;
    }

    .create-account-field-icon {
        width: 18px;
        height: 18px;
    }

        .create-account-field-icon svg {
            width: 18px;
            height: 18px;
        }

    .create-account-button {
        height: 48px;
        padding-left: 16px;
        padding-right: 16px;
        border-radius: 12px;
    }

    .create-account-button-text {
        font-size: 18px;
    }

    .create-account-footer {
        width: 100%;
    }

    .create-account-footer-text,
    .create-account-footer-link {
        font-size: 14px;
    }

    .create-account-general-error {
        padding: 10px 12px;
        font-size: 13px;
    }

    .create-account-modal-close {
        width: 20px;
        height: 20px;
    }

    .create-account-modal-close svg {
        width: 20px;
        height: 20px;
    }

    #createAccountForm {
        gap: 4px;
    }

    .terms-read-modal-overlay {
        padding: 0;
        align-items: stretch;
    }

    .terms-read-modal {
        width: 100%;
        max-width: 100%;
        max-height: 100dvh;
        min-height: 100dvh;
        border-radius: 0;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .terms-read-modal-header {
        padding-top: max(14px, env(safe-area-inset-top, 0));
        padding-left: max(16px, env(safe-area-inset-left, 0));
        padding-right: max(16px, env(safe-area-inset-right, 0));
    }

    .terms-read-modal-footer {
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0));
        padding-left: max(16px, env(safe-area-inset-left, 0));
        padding-right: max(16px, env(safe-area-inset-right, 0));
    }

    /* Full-screen terms modal: content height drives scroll; avoid a large min-height fighting iOS flex */
    .terms-pdf-viewer {
        min-height: 0;
        padding: 10px;
    }

    .terms-pdf-canvas-host {
        min-height: 120px;
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    .create-account-modal {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .create-account-container {
        padding: 16px 16px;
        gap: 4px;
        border-radius: 0;
    }

    .create-account-header {
        gap: 6px;
    }

    .create-account-icon {
        width: 44px;
        height: 44px;
        border-radius: 22px;
    }

    .create-account-icon-svg {
        width: 18px;
        height: 18px;
    }

        .create-account-icon-svg svg {
            width: 18px;
            height: 18px;
        }

    .create-account-title {
        font-size: 17px;
    }

    .create-account-text-field,
    .create-account-text-field-with-height,
    .create-account-password-field {
        gap: 4px;
    }

    .create-account-label {
        font-size: 13px;
    }

    .create-account-field {
        padding: 10px 12px;
        border-radius: 8px;
    }

    .create-account-input {
        font-size: 13px;
    }

    .create-account-placeholder,
    .create-account-placeholder-small {
        font-size: 13px;
    }

    .create-account-field-icon {
        width: 16px;
        height: 16px;
    }

        .create-account-field-icon svg {
            width: 16px;
            height: 16px;
        }

    .create-account-button {
        height: 44px;
        padding-left: 12px;
        padding-right: 12px;
        border-radius: 10px;
    }

    .create-account-button-text {
        font-size: 16px;
    }

    .create-account-footer-text,
    .create-account-footer-link {
        font-size: 13px;
    }

    .create-account-general-error {
        padding: 8px 10px;
        font-size: 12px;
    }

    .create-account-modal-close {
        width: 18px;
        height: 18px;
    }

    .create-account-modal-close svg {
        width: 18px;
        height: 18px;
    }

    #createAccountForm {
        gap: 4px;
    }

    .create-account-text-field .text-danger,
    .create-account-password-field .text-danger {
        font-size: 11px;
    }
}
