/* Student Flatmate Finder — mobile-first theme on top of Bootstrap 5.3. Brand colours come from
   CSS variables (--brand, --accent) set from admin Branding settings. */
:root { --brand: #2f6fed; --accent: #ff7a45; --radius: 1rem; }
[data-bs-theme="light"] { --bs-body-bg: #f6f7fb; --surface: #fff; }
[data-bs-theme="dark"] { --bs-body-bg: #0f131a; --surface: #182029; }
:root, [data-bs-theme] { --bs-primary: var(--brand); --bs-link-color: var(--brand); --bs-link-hover-color: color-mix(in srgb, var(--brand) 80%, #000); }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; -webkit-font-smoothing: antialiased; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: color-mix(in srgb, var(--brand) 85%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--brand) 85%, #000); --bs-btn-active-bg: color-mix(in srgb, var(--brand) 75%, #000); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand); }
.text-primary { color: var(--brand) !important; }
.bg-primary, .text-bg-primary, .progress-bar, .nav-pills .nav-link.active { background-color: var(--brand) !important; }
.form-control:focus, .form-select:focus { border-color: color-mix(in srgb, var(--brand) 60%, #fff); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 25%, transparent); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.card { background-color: var(--surface); border-radius: var(--radius); }
.list-group { --bs-list-group-bg: var(--surface); border-radius: var(--radius); }
.text-pre { white-space: pre-line; }
.min-w-0 { min-width: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }

/* Navigation */
.app-navbar { background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
.app-navbar .nav-link.active { color: var(--brand); font-weight: 600; }
.brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; font-size: .85rem; font-weight: 800; letter-spacing: .02em; }
.nav-icon { color: var(--bs-body-color); font-size: 1.25rem; padding: .25rem .5rem; text-decoration: none; }
.nav-icon.dropdown-toggle::after { display: none; }
.badge-dot { position: absolute; top: 0; right: 0; font-size: .6rem; }
.admin-nav { background: var(--surface); }
.admin-nav .nav-link { padding: .75rem .25rem; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--bs-border-color); padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom)); }
.bottom-nav a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; font-size: .7rem; color: var(--bs-secondary-color); text-decoration: none; min-height: 44px; justify-content: center; }
.bottom-nav a i { font-size: 1.3rem; line-height: 1; }
.bottom-nav a.active { color: var(--brand); font-weight: 600; }
.bottom-nav .badge { position: absolute; top: 0; left: 55%; font-size: .6rem; }
body.has-bottom-nav { padding-bottom: 4.5rem; }
@media (min-width: 992px) { body.has-bottom-nav { padding-bottom: 0; } }
.site-footer a { color: inherit; }

/* Avatars & chips */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-initials { display: inline-grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 80%, #fff), var(--accent)); color: #fff; font-weight: 700; }
.avatar-sm { width: 2.25rem; height: 2.25rem; font-size: .8rem; }
.avatar-md { width: 3rem; height: 3rem; }
.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1.1rem; }
.avatar-xl { width: 5rem; height: 5rem; font-size: 1.5rem; }
.avatar-xxl { width: 8rem; height: 8rem; font-size: 2.5rem; }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .6rem; border-radius: 999px; background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color-translucent); font-size: .8rem; }
.chip-ok { background: color-mix(in srgb, #20c997 14%, transparent); border-color: color-mix(in srgb, #20c997 35%, transparent); }
.chip-warn { background: color-mix(in srgb, #fd7e14 14%, transparent); border-color: color-mix(in srgb, #fd7e14 35%, transparent); }

/* Home */
.hero { background: radial-gradient(1200px 400px at 10% 0%, color-mix(in srgb, var(--accent) 45%, transparent), transparent), linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #1b1464)); color: #fff; }
.hero .lead { color: rgba(255, 255, 255, .88); }
.hero-pill { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 500; }
.hero-card { background: var(--surface); color: var(--bs-body-color); border-radius: 1.25rem; padding: 1.25rem; transform: rotate(2deg); }
.score-pill { background: color-mix(in srgb, #20c997 20%, transparent); color: #0f7a5c; font-weight: 700; border-radius: 999px; padding: .25rem .6rem; }
.step-ico { width: 3.5rem; height: 3.5rem; margin: 0 auto; display: grid; place-items: center; border-radius: 1rem; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-size: 1.5rem; }

/* Listings */
.listing-card { overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.listing-card:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .08) !important; }
.listing-thumb { background: var(--bs-tertiary-bg); }
.listing-thumb img { width: 100%; height: 100%; }
.thumb-empty { display: grid !important; place-items: center; font-size: 2.5rem; color: var(--bs-secondary-color); }
.thumb-sm { width: 4.5rem; height: 3.5rem; border-radius: .5rem; overflow: hidden; background: var(--bs-tertiary-bg); display: grid; place-items: center; flex-shrink: 0; }
.thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.facts .fact { background: var(--surface); border: 1px solid var(--bs-border-color-translucent); border-radius: .75rem; padding: .6rem .75rem; height: 100%; }
.facts .fact small { display: block; color: var(--bs-secondary-color); font-size: .75rem; }
@media (max-width: 991.98px) { .offcanvas-lg .offcanvas-body { padding-top: 0; } }

/* Swipe deck */
.deck-wrap { max-width: 420px; margin: 0 auto; }
.deck { position: relative; height: min(68vh, 560px); }
.deck-empty, .deck-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.deck-empty[hidden], .deck-loading[hidden] { display: none; }
.swipe-card { position: absolute; inset: 0; border-radius: 1.25rem; background: var(--surface); box-shadow: 0 .75rem 2rem rgba(0, 0, 0, .12); overflow: hidden; display: flex; flex-direction: column; touch-action: pan-y; user-select: none; transition: transform .28s ease, opacity .28s ease; transform: scale(.96) translateY(10px); }
.swipe-card.is-top { transform: none; cursor: grab; }
.swipe-card.dragging { transition: none; cursor: grabbing; }
.swipe-card.fly-right { transform: translateX(140%) rotate(18deg) !important; opacity: 0; }
.swipe-card.fly-left { transform: translateX(-140%) rotate(-18deg) !important; opacity: 0; }
.swipe-photo { position: relative; flex: 0 0 52%; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 75%, #fff), var(--accent)); display: grid; place-items: center; }
.swipe-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.swipe-initials { color: #fff; font-size: 4rem; font-weight: 800; }
.swipe-body { padding: 1rem 1.1rem; overflow-y: auto; flex: 1; }
.swipe-body .bio { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.score-badge { position: absolute; left: .75rem; bottom: .75rem; background: rgba(0, 0, 0, .6); color: #fff; border-radius: 999px; padding: .25rem .7rem; font-size: .85rem; }
.stamp { position: absolute; top: 1.25rem; padding: .2rem .6rem; border: 3px solid; border-radius: .5rem; font-weight: 800; font-size: 1.6rem; opacity: 0; transition: opacity .1s; }
.stamp-like { left: 1rem; color: #20c997; transform: rotate(-12deg); }
.stamp-pass { right: 1rem; color: #dc3545; transform: rotate(12deg); }
.hint-like .stamp-like, .hint-pass .stamp-pass { opacity: 1; }
.deck-actions { display: flex; justify-content: center; gap: 1.25rem; margin-top: 1rem; }
.deck-actions .btn { width: 4rem; height: 4rem; border-radius: 50%; font-size: 1.5rem; background: var(--surface); box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .1); border: 0; }
.deck-actions .btn-info-card { width: 3.2rem; height: 3.2rem; font-size: 1.1rem; align-self: center; color: var(--brand); }
.btn-pass { color: #dc3545; }
.btn-like { color: #fff !important; background: linear-gradient(135deg, var(--accent), #ff3d6e) !important; }
.deck-actions .btn:disabled { opacity: .4; }
.compat-ring { --pct: 50; width: 5.5rem; height: 5.5rem; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--bs-tertiary-bg) 0); }
.compat-ring span { width: 4.4rem; height: 4.4rem; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; }

/* Chat */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 9.5rem); max-width: 820px; margin: 0 auto; overflow: hidden; }
@media (max-width: 991.98px) { .chat-page main { padding: 0 !important; } .chat-page .site-footer { display: none; } .chat { height: calc(100dvh - 3.6rem - 4.3rem); border-radius: 0; } }
.chat-safety { background: color-mix(in srgb, #ffc107 12%, transparent); }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; }
.msg { max-width: 80%; align-self: flex-start; }
.msg.mine { align-self: flex-end; text-align: right; }
.bubble { display: inline-block; text-align: left; padding: .5rem .8rem; border-radius: 1rem 1rem 1rem .25rem; background: var(--bs-tertiary-bg); white-space: pre-wrap; word-break: break-word; }
.msg.mine .bubble { background: var(--brand); color: #fff; border-radius: 1rem 1rem .25rem 1rem; }
.bubble.removed { opacity: .6; }
.msg .meta { font-size: .7rem; color: var(--bs-secondary-color); margin-top: .1rem; }
.chat-form textarea { resize: none; max-height: 140px; }

/* Auth */
.auth-body { min-height: 100vh; display: flex; align-items: center; background: radial-gradient(800px 300px at 50% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent); }
.auth-wrap { width: 100%; max-width: 460px; margin: 0 auto; padding: 2rem 1rem; }
.otp-input { letter-spacing: .5em; font-variant-numeric: tabular-nums; }
.step-pills .nav-link { padding: .35rem .5rem; }

/* Admin */
.stat-card { color: inherit; }
a.stat-card:hover { box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .08) !important; }
.stat-danger { border-left: 4px solid #dc3545 !important; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.bar-day { flex: 1; display: flex; align-items: flex-end; gap: 1px; height: 100%; }
.bar-day span { flex: 1; min-height: 1px; border-radius: 2px 2px 0 0; }
.b1, .legend.l1 { background: var(--brand); }
.b2, .legend.l2 { background: var(--accent); }
.b3, .legend.l3 { background: #20c997; }
.legend { display: inline-block; width: .75rem; height: .75rem; border-radius: 2px; vertical-align: middle; }
.content-page h2 { margin-top: 1.5rem; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
