/* ═══════════════════════════════════════════════════════════════
   Legal re-consent modal (Requirement 11.2 / 11.4)

   Full-screen overlay rendered from _Layout.cshtml. While visible
   it must block all interaction with the page beneath — both the
   backdrop (pointer-events: auto) and a `body.as-legal-reconsent-open`
   class that locks scroll on the document body achieve that without
   relying on JS focus traps that can be defeated by tabbing.
   ═══════════════════════════════════════════════════════════════ */

.as-legal-reconsent {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.as-legal-reconsent[hidden] {
    display: none;
}

.as-legal-reconsent-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
}

.as-legal-reconsent-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.32);
    display: flex;
    flex-direction: column;
    gap: 20px;
    color: #0f172a;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.as-legal-reconsent-header h2 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.as-legal-reconsent-description {
    margin: 0;
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
}

.as-legal-reconsent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.as-legal-reconsent-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.as-legal-reconsent-item-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.as-legal-reconsent-item-meta {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Inline "Tam mətni oxu" toggle — replaces the previous external link.
   Clicking it expands an inline body panel (sibling .as-legal-reconsent-body)
   so the user can read the document without leaving the modal. The button is
   styled to look like the previous link (purple, underlined on hover) but
   exposes a chevron that rotates to indicate expansion state. */
.as-legal-reconsent-toggle {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #6366f1;
    cursor: pointer;
    text-align: left;
}

.as-legal-reconsent-toggle:hover .as-legal-reconsent-toggle-label,
.as-legal-reconsent-toggle:focus .as-legal-reconsent-toggle-label {
    color: #4f46e5;
}

.as-legal-reconsent-toggle:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.4);
    outline-offset: 2px;
    border-radius: 4px;
}

.as-legal-reconsent-toggle-label {
    text-decoration: underline;
    color: inherit;
}

.as-legal-reconsent-toggle-chev {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    transform: rotate(0deg);
    color: currentColor;
}

.as-legal-reconsent-toggle[aria-expanded="true"] .as-legal-reconsent-toggle-chev {
    transform: rotate(180deg);
}

/* Inline document body panel — populated lazily on first expand by
   legal-reconsent.js (renderMarkdownSafe). Constrained height with internal
   scroll so a long Terms document never blows the modal out of the viewport. */
.as-legal-reconsent-body {
    margin-top: 4px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    max-height: 280px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
}

.as-legal-reconsent-body[hidden] {
    display: none;
}

.as-legal-reconsent-body p {
    margin: 0 0 10px 0;
}

.as-legal-reconsent-body p:last-child {
    margin-bottom: 0;
}

.as-legal-reconsent-body h1,
.as-legal-reconsent-body h2,
.as-legal-reconsent-body h3 {
    margin: 14px 0 6px 0;
    color: #0f172a;
    font-weight: 600;
    line-height: 1.3;
}

.as-legal-reconsent-body h1 {
    font-size: 17px;
}

.as-legal-reconsent-body h2 {
    font-size: 15px;
}

.as-legal-reconsent-body h3 {
    font-size: 14px;
}

.as-legal-reconsent-body h1:first-child,
.as-legal-reconsent-body h2:first-child,
.as-legal-reconsent-body h3:first-child {
    margin-top: 0;
}

.as-legal-reconsent-body ul,
.as-legal-reconsent-body ol {
    margin: 0 0 10px 0;
    padding-left: 20px;
}

.as-legal-reconsent-body li {
    margin-bottom: 4px;
}

.as-legal-reconsent-body a {
    color: #6366f1;
    text-decoration: underline;
}

.as-legal-reconsent-body a:hover,
.as-legal-reconsent-body a:focus {
    color: #4f46e5;
}

.as-legal-reconsent-body code {
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12.5px;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

.as-legal-reconsent-body-status {
    margin: 0;
    color: #64748b;
    font-style: italic;
}

.as-legal-reconsent-body-status.is-error {
    color: #b91c1c;
    font-style: normal;
}

@media (max-width: 480px) {
    .as-legal-reconsent-body {
        max-height: 220px;
        font-size: 13.5px;
        padding: 10px;
    }
}

.as-legal-reconsent-item-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
}

.as-legal-reconsent-item-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #6366f1;
}

.as-legal-reconsent-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.as-legal-reconsent-accept {
    appearance: none;
    border: 0;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.as-legal-reconsent-accept:hover:not(:disabled) {
    transform: translateY(-1px);
}

.as-legal-reconsent-accept:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.as-legal-reconsent-signout {
    align-self: center;
    color: #ef4444;
    font-size: 13px;
    text-decoration: underline;
}

.as-legal-reconsent-signout:hover,
.as-legal-reconsent-signout:focus {
    color: #dc2626;
}

/* Lock background scroll while the modal is open. Applied to <body> by
   legal-reconsent.js when the modal is revealed. */
body.as-legal-reconsent-open {
    overflow: hidden;
}


/* ═══════════════════════════════════════════════════════════════
   Bundle layout (Pattern A — single "I agree" with linkified docs)
   ───────────────────────────────────────────────────────────────
   Replaces the 4-card stack with a compact link list + one
   bundled checkbox. Mirrors how Stripe/Amazon/Airbnb collapse
   "By signing up you agree to Terms / Privacy / Refund" into a
   single legal affordance. Each link expands an inline body
   panel using the existing `.as-legal-reconsent-body` styles
   above so users can read documents without leaving the modal.
   ═══════════════════════════════════════════════════════════════ */

.as-legal-reconsent-bundle {
    list-style: none;
    margin: 0;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.as-legal-reconsent-link-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.as-legal-reconsent-link-item {
    display: flex;
    flex-direction: column;
}

.as-legal-reconsent-link-toggle {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 8px 6px;
    margin: 0;
    cursor: pointer;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    text-align: left;
    color: inherit;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.as-legal-reconsent-link-toggle:hover {
    background: rgba(99, 102, 241, 0.06);
}

.as-legal-reconsent-link-toggle:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.4);
    outline-offset: 2px;
}

.as-legal-reconsent-link-title {
    font-size: 14px;
    font-weight: 600;
    color: #4f46e5;
    text-decoration: underline;
    text-decoration-color: rgba(79, 70, 229, 0.4);
    text-underline-offset: 2px;
}

.as-legal-reconsent-link-meta {
    font-size: 12px;
    color: #64748b;
    font-weight: 400;
}

.as-legal-reconsent-link-toggle .as-legal-reconsent-toggle-chev {
    color: #94a3b8;
}

.as-legal-reconsent-link-toggle[aria-expanded="true"] {
    background: rgba(99, 102, 241, 0.08);
}

.as-legal-reconsent-link-toggle[aria-expanded="true"] .as-legal-reconsent-toggle-chev {
    transform: rotate(180deg);
}

/* Inline body inherits .as-legal-reconsent-body sizing from the
   original layout — we only need to tighten the top spacing
   when the body is nested inside the bundle's link list. */
.as-legal-reconsent-link-item > .as-legal-reconsent-body {
    margin-top: 4px;
    margin-left: 8px;
    margin-right: 8px;
}

.as-legal-reconsent-bundle-checkbox {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #1e293b;
    line-height: 1.5;
}

.as-legal-reconsent-bundle-checkbox input {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
    flex-shrink: 0;
    cursor: pointer;
}

.as-legal-reconsent-bundle-checkbox:hover {
    background: rgba(99, 102, 241, 0.09);
}
