/* ============================================================
   RetreatReg — Design System (Hebrew RTL, mobile-first)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800&family=Assistant:wght@400;600;700&display=swap');

/* ---------- Theme variables (event/company brand overrides --rr-primary) ---------- */
:root {
    --rr-primary: #4f46e5;
    --rr-primary-rgb: 79, 70, 229;
    --rr-primary-dark: #4338ca;
    --rr-primary-soft: rgba(var(--rr-primary-rgb), .1);
    --rr-secondary: #64748b;

    --rr-success: #059669;
    --rr-success-soft: #d1fae5;
    --rr-warning: #b45309;
    --rr-warning-soft: #fef3c7;
    --rr-danger: #dc2626;
    --rr-danger-soft: #fee2e2;
    --rr-info: #0369a1;
    --rr-info-soft: #e0f2fe;

    --rr-bg: #f1f5f9;
    --rr-surface: #ffffff;
    --rr-text: #0f172a;
    --rr-muted: #64748b;
    --rr-border: #e2e8f0;

    --rr-radius: 1rem;
    --rr-radius-sm: .625rem;
    --rr-shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 10px 30px rgba(15, 23, 42, .07);
    --rr-shadow-sm: 0 1px 2px rgba(15, 23, 42, .07);

    --rr-sidebar-w: 264px;
    --rr-font: 'Heebo', 'Assistant', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
}

/* ---------- Dark theme (html[data-theme="dark"], toggled from the UI, saved in localStorage) ---------- */
html[data-theme="dark"] {
    --rr-bg: #0f172a;
    --rr-surface: #1e293b;
    --rr-text: #e2e8f0;
    --rr-muted: #94a3b8;
    --rr-border: #334155;

    --rr-success: #34d399;
    --rr-success-soft: rgba(16, 185, 129, .16);
    --rr-warning: #fbbf24;
    --rr-warning-soft: rgba(245, 158, 11, .16);
    --rr-danger: #f87171;
    --rr-danger-soft: rgba(239, 68, 68, .16);
    --rr-info: #7dd3fc;
    --rr-info-soft: rgba(14, 165, 233, .16);
    --rr-primary-soft: rgba(var(--rr-primary-rgb), .22);

    --rr-shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .4);
    --rr-shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
}

html[data-theme="dark"] .rr-table thead th { background: rgba(255, 255, 255, .04); color: var(--rr-muted); }
html[data-theme="dark"] .rr-table tbody tr:hover { background: rgba(255, 255, 255, .04); }
html[data-theme="dark"] .rr-badge-muted { background: #334155; color: #cbd5e1; }
html[data-theme="dark"] .rr-icon-btn { background: transparent; color: var(--rr-muted); }
html[data-theme="dark"] .rr-chart-placeholder { background: rgba(255, 255, 255, .03); }
html[data-theme="dark"] .rr-step::before { background: #334155; color: var(--rr-muted); }
html[data-theme="dark"] .rr-step:not(:last-child)::after { background: #334155; }
html[data-theme="dark"] .rr-roommate-chip { background: var(--rr-surface); border-color: var(--rr-border); }
html[data-theme="dark"] .rr-public-header,
html[data-theme="dark"] .rr-topbar,
html[data-theme="dark"] .rr-sticky-actions { background: var(--rr-surface); }
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select { background: #0f172a; border-color: var(--rr-border); color: var(--rr-text); }
html[data-theme="dark"] .form-control::placeholder { color: #64748b; }
html[data-theme="dark"] .input-group-text { background: transparent; border-color: var(--rr-border); color: var(--rr-muted); }
html[data-theme="dark"] code { color: #93c5fd; }

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }

body {
    font-family: var(--rr-font);
    background: var(--rr-bg);
    color: var(--rr-text);
    text-align: right;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; }

a { color: var(--rr-primary); }
a:hover { color: var(--rr-primary-dark); }

/* ---------- Bootstrap overrides → premium look ---------- */
.btn {
    border-radius: var(--rr-radius-sm);
    font-weight: 600;
    padding: .55rem 1.25rem;
    /* iOS Safari: remove the tap delay + double-tap-to-zoom so a single tap always registers */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, .05);
    cursor: pointer;
}

.btn-lg { padding: .8rem 1.6rem; border-radius: var(--rr-radius-sm); }

.btn-primary {
    background: var(--rr-primary);
    border-color: var(--rr-primary);
    box-shadow: 0 4px 14px rgba(var(--rr-primary-rgb), .3);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--rr-primary-dark) !important;
    border-color: var(--rr-primary-dark) !important;
}

.btn-outline-primary { color: var(--rr-primary); border-color: var(--rr-primary); }
.btn-outline-primary:hover { background: var(--rr-primary); border-color: var(--rr-primary); }

.card {
    border: 0;
    border-radius: var(--rr-radius);
    box-shadow: var(--rr-shadow);
    background: var(--rr-surface);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--rr-border);
    font-weight: 700;
    padding: 1rem 1.5rem;
}

.card-body { padding: 1.5rem; }

.form-control, .form-select {
    border-radius: var(--rr-radius-sm);
    border-color: var(--rr-border);
    padding: .65rem .9rem;
    font-size: 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--rr-primary);
    box-shadow: 0 0 0 .2rem rgba(var(--rr-primary-rgb), .15);
}

.form-label { font-weight: 600; margin-bottom: .35rem; }
.form-text { color: var(--rr-muted); }

.form-check-input:checked { background-color: var(--rr-primary); border-color: var(--rr-primary); }

.alert { border: 0; border-radius: var(--rr-radius-sm); }

.dropdown-menu { border: 0; border-radius: var(--rr-radius-sm); box-shadow: var(--rr-shadow); }

/* ---------- Page header ---------- */
.rr-page-header {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.rr-page-header h1 { font-size: 1.45rem; margin: 0; }
.rr-page-header .rr-page-subtitle { color: var(--rr-muted); font-size: .9rem; margin: 0; }

/* ---------- Admin shell: sidebar + main ---------- */
.rr-admin-wrapper { display: flex; min-height: 100vh; }

.rr-sidebar {
    width: var(--rr-sidebar-w);
    background: #0f172a;
    color: #cbd5e1;
    flex-shrink: 0;
}

.rr-sidebar .rr-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.25rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
}

.rr-sidebar .rr-brand .bi { color: var(--rr-primary); font-size: 1.4rem; }

.rr-sidebar-nav {
    list-style: none;
    padding: .5rem .75rem 1.5rem;
    margin: 0;
}

.rr-sidebar-nav .rr-nav-section {
    font-size: .72rem;
    letter-spacing: .04em;
    color: #64748b;
    padding: 1rem .75rem .35rem;
}

.rr-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .75rem;
    margin-bottom: .15rem;
    border-radius: var(--rr-radius-sm);
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.rr-sidebar-nav a .bi { font-size: 1.05rem; width: 1.3rem; text-align: center; }

.rr-sidebar-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.rr-sidebar-nav a.active {
    background: var(--rr-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(var(--rr-primary-rgb), .35);
}

.rr-sidebar-nav a.disabled { color: #475569; pointer-events: none; }

.rr-soon-badge {
    font-size: .62rem;
    background: rgba(255, 255, 255, .08);
    color: #94a3b8;
    border-radius: 1rem;
    padding: .1rem .5rem;
    margin-inline-start: auto;
}

.rr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.rr-topbar {
    background: var(--rr-surface);
    box-shadow: var(--rr-shadow-sm);
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.rr-topbar .rr-context { font-weight: 600; font-size: .95rem; }
.rr-topbar .rr-context .text-muted { font-weight: 400; }

.rr-content { padding: 1.5rem; }

@media (min-width: 992px) {
    .rr-content { padding: 2rem 2.5rem; }
}

/* Mobile: sidebar becomes offcanvas (Bootstrap handles behavior) */
@media (max-width: 991.98px) {
    .rr-sidebar { width: min(85vw, 300px); }
}

/* ---------- KPI cards ---------- */
.rr-kpi {
    background: var(--rr-surface);
    border-radius: var(--rr-radius);
    box-shadow: var(--rr-shadow);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.rr-kpi .rr-kpi-icon {
    width: 3rem;
    height: 3rem;
    border-radius: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: var(--rr-primary-soft);
    color: var(--rr-primary);
    flex-shrink: 0;
}

.rr-kpi .rr-kpi-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.rr-kpi .rr-kpi-label { color: var(--rr-muted); font-size: .85rem; }

.rr-kpi.rr-kpi-success .rr-kpi-icon { background: var(--rr-success-soft); color: var(--rr-success); }
.rr-kpi.rr-kpi-warning .rr-kpi-icon { background: var(--rr-warning-soft); color: var(--rr-warning); }
.rr-kpi.rr-kpi-danger .rr-kpi-icon { background: var(--rr-danger-soft); color: var(--rr-danger); }

/* ---------- Status badges ---------- */
.rr-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border-radius: 2rem;
    padding: .3rem .8rem;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

.rr-badge-success { background: var(--rr-success-soft); color: var(--rr-success); }
.rr-badge-warning { background: var(--rr-warning-soft); color: var(--rr-warning); }
.rr-badge-danger { background: var(--rr-danger-soft); color: var(--rr-danger); }
.rr-badge-info { background: var(--rr-info-soft); color: var(--rr-info); }
.rr-badge-muted { background: #e2e8f0; color: var(--rr-secondary); }

/* ---------- Modern tables ---------- */
.rr-table-card { overflow: hidden; }
.rr-table-card .rr-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--rr-border);
}

.rr-table-card .rr-search { max-width: 280px; }

.rr-table { margin: 0; }

.rr-table thead th {
    background: #f8fafc;
    color: var(--rr-muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
    border-bottom: 1px solid var(--rr-border);
    padding: .8rem 1.5rem;
    white-space: nowrap;
}

.rr-table tbody td {
    padding: .9rem 1.5rem;
    vertical-align: middle;
    border-color: var(--rr-border);
}

.rr-table tbody tr:hover { background: #f8fafc; }
.rr-table tbody tr:last-child td { border-bottom: 0; }

.rr-table-actions { display: flex; gap: .35rem; justify-content: flex-end; }

.rr-icon-btn {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: .55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rr-border);
    background: var(--rr-surface);
    color: var(--rr-muted);
    transition: all .15s;
}

.rr-icon-btn:hover { border-color: var(--rr-primary); color: var(--rr-primary); background: var(--rr-primary-soft); }
.rr-icon-btn.rr-icon-btn-danger:hover { border-color: var(--rr-danger); color: var(--rr-danger); background: var(--rr-danger-soft); }
.rr-icon-btn.rr-icon-btn-warning { border-color: var(--rr-warning); color: var(--rr-warning); }
.rr-icon-btn.rr-icon-btn-warning:hover { border-color: var(--rr-warning); color: var(--rr-warning); background: var(--rr-warning-soft); }

/* Styled file dropzone */
.rr-dropzone {
    border: 2px dashed var(--rr-border);
    border-radius: 12px;
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: transparent;
    flex: 1 1 240px; /* fills width in a block container, and grows nicely inside a flex row */
}
.rr-dropzone:hover,
.rr-dropzone.dragover {
    border-color: var(--rr-primary);
    background: var(--rr-primary-soft);
}
.rr-dropzone .rr-dz-icon { font-size: 1.9rem; color: var(--rr-muted); }
.rr-dropzone .rr-dz-text { color: var(--rr-text); font-size: .92rem; margin-top: 4px; }
.rr-dropzone .rr-dz-hint { color: var(--rr-muted); font-size: .75rem; margin-top: 2px; }
.rr-dz-preview { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; }
.rr-dz-file { display: flex; align-items: center; gap: 8px; }
.rr-dz-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rr-border); }
.rr-dz-name { font-weight: 600; word-break: break-all; }

/* Passport preview image inside a SweetAlert popup — shrink large scans to fit the screen */
.rr-passport-img {
    max-width: 80vw;
    max-height: 68vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

/* Admin footer */
.rr-footer {
    padding: 14px 24px;
    text-align: center;
    font-size: .8rem;
    color: var(--rr-muted);
    border-top: 1px solid var(--rr-border);
    margin-top: auto;
}

/* Top-bar company/event picker */
.rr-context-picker .form-select { min-width: 0; }
@media (max-width: 640px) {
    .rr-context-picker { width: 100%; }
    .rr-context-picker form { flex: 1 1 auto; }
    .rr-context-picker .form-select { width: 100%; }
}

/* ---------- Stepper (registration wizard) ---------- */
.rr-stepper {
    display: flex;
    justify-content: space-between;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.rr-step {
    flex: 1;
    text-align: center;
    position: relative;
    font-size: .72rem;
    color: var(--rr-muted);
}

.rr-step::before {
    counter-increment: step;
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    margin: 0 auto .35rem;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--rr-muted);
    font-weight: 700;
    font-size: .85rem;
    position: relative;
    z-index: 1;
}

/* connector line (RTL aware — each step draws the line back to the PREVIOUS step) */
.rr-step:not(:first-child)::after {
    content: '';
    position: absolute;
    top: 1.05rem;
    inset-inline-start: -50%;
    width: 100%;
    height: 2px;
    background: #e2e8f0;
}

.rr-step.done::before { background: var(--rr-success); color: #fff; content: '✓'; }
.rr-step.done:not(:first-child)::after,
.rr-step.active:not(:first-child)::after { background: var(--rr-success); }

.rr-step.active { color: var(--rr-primary); font-weight: 700; }
.rr-step.active::before {
    background: var(--rr-primary);
    color: #fff;
    box-shadow: 0 0 0 5px rgba(var(--rr-primary-rgb), .15);
}

@media (max-width: 575.98px) {
    .rr-step { font-size: .62rem; }
    .rr-step::before { width: 1.8rem; height: 1.8rem; }
    .rr-step:not(:first-child)::after { top: .9rem; }
}

/* ---------- Public registration ---------- */
.rr-public-body { background: var(--rr-bg); }

/* Event header banner — shown on every public registration page.
   Default mode: fill & crop (cover). --full modifier: whole image, natural height. */
.rr-header-banner {
    width: 100%;
    max-height: 220px;
    overflow: hidden;
    line-height: 0;
}

.rr-header-banner img {
    width: 100%;
    height: 100%;
    max-height: 220px;
    object-fit: cover;
}

@media (max-width: 767.98px) {
    .rr-header-banner:not(.rr-header-banner--full),
    .rr-header-banner:not(.rr-header-banner--full) img { max-height: 140px; }
}

.rr-header-banner--full,
.rr-header-banner--full img {
    max-height: none;
    height: auto;
    object-fit: unset;
}

.rr-public-header {
    background: var(--rr-surface);
    box-shadow: var(--rr-shadow-sm);
    padding: .8rem 1rem;
}

.rr-public-header .rr-logo {
    max-height: 42px;
    max-width: 140px;
    object-fit: contain;
}

.rr-hero {
    background: linear-gradient(135deg, var(--rr-primary), var(--rr-primary-dark));
    color: #fff;
    border-radius: var(--rr-radius);
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.rr-hero.rr-hero-image {
    background-size: cover;
    background-position: center;
}

.rr-hero.rr-hero-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(var(--rr-primary-rgb), .88), rgba(15, 23, 42, .55));
}

.rr-hero > * { position: relative; }

.rr-hero .rr-hero-company { opacity: .85; font-size: .9rem; margin-bottom: .25rem; }
.rr-hero h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: .75rem; }

.rr-hero .rr-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
    font-size: .9rem;
    opacity: .95;
}

.rr-hero .rr-hero-meta .bi { margin-inline-end: .35rem; }

.rr-public-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.25rem 1rem 6.5rem; /* bottom space keeps sticky bar clear of browser UI */
}

@media (min-width: 768px) {
    .rr-public-container { padding-top: 2rem; }
    .rr-hero { padding: 2.5rem 2rem; }
    .rr-hero h1 { font-size: 2rem; }
}

/* ---------- Mobile sticky action bar ---------- */
.rr-sticky-actions {
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    background: var(--rr-surface);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, .1);
    padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
    z-index: 1030;
    touch-action: manipulation;
    /* keep the bar on its own compositor layer so iOS doesn't "settle" it on the first tap */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.rr-sticky-actions .btn { width: 100%; }

@media (min-width: 768px) {
    .rr-sticky-actions { position: static; box-shadow: none; background: transparent; padding: 0; }
    .rr-sticky-actions .btn { width: auto; }
}

/* Touch-friendly buttons on mobile */
@media (max-width: 767.98px) {
    .rr-public-container .btn-primary,
    .rr-public-container .btn-outline-secondary { width: 100%; padding: .85rem 1rem; font-size: 1.05rem; }
}

/* ---------- Roommate selection ---------- */
.rr-roommate-chip {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--rr-surface);
    border: 1px solid var(--rr-border);
    border-radius: var(--rr-radius-sm);
    padding: .7rem 1rem;
    margin-bottom: .5rem;
}

.rr-roommate-chip .rr-avatar {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: var(--rr-primary-soft);
    color: var(--rr-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.rr-roommate-chip .rr-roommate-name { font-weight: 600; }
.rr-roommate-chip .rr-roommate-meta { font-size: .8rem; color: var(--rr-muted); }
.rr-roommate-chip .rr-badge { margin-inline-start: auto; }

/* Member still needs to approve — highlighted in the admin rooms screen */
.rr-roommate-chip--pending {
    border-color: var(--rr-warning);
    background: var(--rr-warning-soft);
    box-shadow: inset 3px 0 0 var(--rr-warning);
}

/* ---------- Quick actions ---------- */
.rr-quick-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.rr-quick-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

/* ---------- Chart placeholder ---------- */
.rr-chart-placeholder {
    height: 260px;
    border: 2px dashed var(--rr-border);
    border-radius: var(--rr-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rr-muted);
    background: #f8fafc;
}

/* ---------- Empty state ---------- */
.rr-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--rr-muted);
}

.rr-empty .bi { font-size: 2.5rem; opacity: .4; display: block; margin-bottom: .75rem; }

/* ---------- Utilities ---------- */
.rr-text-muted { color: var(--rr-muted); }
.rr-surface { background: var(--rr-surface); }
code { direction: ltr; unicode-bidi: embed; }
