/* JR_COOKIE_BANNER_v2 — banner + modal + language picker.
   Position-fixed bottom; sliding banner. No CLS, accessible. */

.jr-cc-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.12);
    color: #1f2937;
    padding: 16px 20px;
    transform: translateY(110%);
    transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
    contain: layout style;
}
.jr-cc-banner[data-shown="true"] {
    transform: translateY(0);
}

.jr-cc-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}
.jr-cc-body {
    flex: 1 1 320px;
    min-width: 0;
}
.jr-cc-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #0f172a;
}
.jr-cc-desc {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    color: #475569;
}
.jr-cc-link {
    color: #a86000;
    text-decoration: underline;
    font-weight: 600;
}
.jr-cc-link:hover,
.jr-cc-link:focus-visible {
    color: #8a4f00;
}

.jr-cc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}
.jr-cc-btn {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 10px;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 160ms, color 160ms, border-color 160ms, box-shadow 160ms;
}
.jr-cc-btn:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}
.jr-cc-btn-primary {
    background: #a86000;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(168, 96, 0, 0.3);
}
.jr-cc-btn-primary:hover { background: #8a4f00; }
.jr-cc-btn-outline {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.jr-cc-btn-outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}
.jr-cc-btn-ghost {
    background: transparent;
    color: #475569;
    text-decoration: underline;
    padding: 10px 8px;
}
.jr-cc-btn-ghost:hover { color: #0f172a; }

/* ---------- Language picker ---------- */
.jr-cc-lang {
    position: relative;
    display: inline-block;
}
.jr-cc-lang-btn {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 8px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 160ms, border-color 160ms, color 160ms;
}
.jr-cc-lang-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}
.jr-cc-lang-btn:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}
.jr-cc-lang-btn[aria-expanded="true"] svg {
    transform: rotate(180deg);
}
.jr-cc-lang-btn svg {
    transition: transform 180ms;
}
.jr-cc-lang-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    margin: 0;
    padding: 6px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    list-style: none;
    min-width: 220px;
    max-height: 50vh;
    overflow-y: auto;
    z-index: 9050;
}
.jr-cc-lang-menu[hidden] { display: none; }
.jr-cc-lang-menu li {
    margin: 0;
    padding: 0;
}
.jr-cc-lang-menu button {
    appearance: none;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.jr-cc-lang-menu button:hover,
.jr-cc-lang-menu button:focus-visible {
    background: #f1f5f9;
    color: #0f172a;
    outline: none;
}
.jr-cc-lang-menu button[aria-selected="true"] {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}
.jr-cc-lang-menu button[aria-selected="true"]::after {
    content: "\2713";
    color: #a86000;
    font-weight: 700;
}
.jr-cc-lang-menu button .jr-cc-lang-code {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: auto;
}

/* RTL support */
.jr-cc-banner[dir="rtl"] .jr-cc-actions {
    justify-content: flex-start;
}
.jr-cc-banner[dir="rtl"] .jr-cc-lang-menu {
    right: auto;
    left: 0;
}

/* ---------- Preferences modal ---------- */
.jr-cc-modal {
    position: fixed;
    inset: 0;
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.jr-cc-modal[hidden] { display: none; }

.jr-cc-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    animation: jr-cc-fade 200ms ease;
}
.jr-cc-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    max-width: 560px;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    animation: jr-cc-pop 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.jr-cc-dialog-head {
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.jr-cc-close {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #64748b;
    padding: 6px;
    border-radius: 8px;
    line-height: 0;
}
.jr-cc-close:hover { background: #f1f5f9; color: #0f172a; }
.jr-cc-close:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

.jr-cc-dialog-body { padding: 18px 20px; overflow-y: auto; }
.jr-cc-dialog-foot {
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.jr-cc-cat { border: 0; padding: 0; margin: 12px 0 0; }
.jr-cc-cat-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border-radius: 12px;
    background: #f8fafc;
}
.jr-cc-cat-label {
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
    margin: 0 0 4px;
    padding: 0;
}
.jr-cc-cat-desc {
    font-size: 13px;
    color: #475569;
    margin: 0;
    line-height: 1.45;
}

.jr-cc-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}
.jr-cc-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.jr-cc-toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 999px;
    transition: background 180ms;
    cursor: pointer;
}
.jr-cc-toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 180ms;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.jr-cc-toggle input:checked + .jr-cc-toggle-slider { background: #a86000; }
.jr-cc-toggle input:checked + .jr-cc-toggle-slider::before { transform: translateX(20px); }
.jr-cc-toggle input:disabled + .jr-cc-toggle-slider { background: #94a3b8; cursor: not-allowed; opacity: 0.85; }
.jr-cc-toggle input:focus-visible + .jr-cc-toggle-slider { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45); }

@keyframes jr-cc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes jr-cc-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
    .jr-cc-banner { padding: 14px 14px env(safe-area-inset-bottom, 14px); }
    .jr-cc-inner { gap: 12px; }
    .jr-cc-actions {
        width: 100%;
        justify-content: space-between;
        position: relative;
    }
    .jr-cc-actions .jr-cc-btn { flex: 1 1 0; padding: 11px 12px; font-size: 13px; min-width: 0; }
    .jr-cc-actions .jr-cc-btn-ghost { flex: 0 0 auto; }
    /* Picker stays inline-block at left of action row */
    .jr-cc-lang { flex: 0 0 auto; order: -1; margin-right: auto; position: static; }
    .jr-cc-title { font-size: 15px; }
    .jr-cc-desc  { font-size: 12.5px; }
    .jr-cc-dialog { border-radius: 14px; max-height: 90vh; }
    /* Anchor menu inside the .jr-cc-actions row (now position:relative) so it
       can stretch the full banner width on mobile instead of overflowing left */
    .jr-cc-lang-menu {
        left: 0;
        right: 0;
        min-width: 0;
        max-height: 55vh;
        bottom: calc(100% + 50px);  /* clear the action buttons */
    }
    /* RTL override on mobile too */
    .jr-cc-banner[dir="rtl"] .jr-cc-lang-menu { left: 0; right: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .jr-cc-banner,
    .jr-cc-dialog,
    .jr-cc-backdrop,
    .jr-cc-toggle-slider,
    .jr-cc-toggle-slider::before,
    .jr-cc-lang-btn svg {
        animation: none !important;
        transition: none !important;
    }
}
