/* Shared terms / legal read modal (registration, checkout refund policy, etc.) */

.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;
}

/* Above fin-refund modal (100070) and reason dropdown panel (100090). */
.eshop-refund-policy-modal-overlay {
    z-index: 100120;
}

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

.terms-read-modal {
    position: relative;
    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::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #e879f9 0%, #6a5d8b 100%);
    z-index: 3;
    pointer-events: none;
}

.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;
}

.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;
}

.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);
}

/* PDF.js canvas viewer (registration terms) */
.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;
    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);
}

.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;
}

.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);
}

/* HTML legal document (refund policy modal) */
.terms-legal-document-viewer {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    padding: 12px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

.terms-legal-document-frame {
    border-radius: 12px;
    background: #525659;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    padding: 12px 10px;
}

.terms-legal-document {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border-radius: 4px;
    padding: 1.25rem 1.35rem 1.5rem;
    color: #1e293b;
    font-family: "IBM Plex Sans Arabic", "Cairo", sans-serif;
    font-size: 0.8125rem;
    line-height: 1.65;
}

[dir="ltr"] .terms-legal-document {
    font-family: "Cairo", sans-serif;
}

.terms-legal-document__watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 0;
}

.terms-legal-document__watermark img {
    width: min(52%, 220px);
    height: auto;
    opacity: 0.06;
    filter: grayscale(1);
}

.terms-legal-document__head,
.terms-legal-document__sections {
    position: relative;
    z-index: 1;
}

.terms-legal-document__logo {
    display: block;
    width: auto;
    height: 2rem;
    margin-inline-start: auto;
    margin-bottom: 0.65rem;
}

.terms-legal-document__rule {
    border: none;
    height: 3px;
    margin: 0 0 1rem;
    background: linear-gradient(90deg, #6a5d8b 0%, #8b7baf 100%);
    border-radius: 2px;
}

.terms-legal-document__title {
    margin: 0 0 0.5rem;
    text-align: center;
    font-size: 1rem;
    font-weight: 800;
    color: #111111;
    line-height: 1.4;
}

.terms-legal-document__meta {
    margin: 0 0 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
}

.terms-legal-document__shop-block {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.65rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.terms-legal-document__shop-line {
    margin: 0 0 0.35rem;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: #475569;
}

.terms-legal-document__shop-line:last-child {
    margin-bottom: 0;
}

.terms-legal-document__shop-platform {
    margin: 0 0 0.45rem;
    font-weight: 700;
    color: #372a58;
}

.terms-legal-document__section + .terms-legal-document__section {
    margin-top: 1.15rem;
    padding-top: 1.15rem;
    border-top: 1px solid #e8e8e8;
}

.terms-legal-document__section-title {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    font-weight: 800;
    color: #111111;
    line-height: 1.4;
}

.terms-legal-document__section-body {
    margin: 0;
    color: #334155;
    line-height: 1.7;
}

.terms-legal-document__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.terms-legal-document__list > li {
    position: relative;
    margin: 0;
    padding-inline-start: 1.05rem;
    color: #334155;
    line-height: 1.65;
}

.terms-legal-document__list > li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.55em;
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 50%;
    background: #6a5d8b;
}

@media (max-width: 768px) {
    .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::before {
        border-radius: 0;
    }

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

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

    .terms-pdf-viewer {
        min-height: 0;
        padding: 10px;
    }

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

    .terms-legal-document-viewer {
        padding: 10px;
    }
}
