:root {
    --kf-primary: #1f4e79;
    --kf-primary-dark: #143452;
    --kf-accent: #f5a623;
    --kf-bg-soft: #f6f8fa;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    min-height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #222;
}

a { color: var(--kf-primary); }
a:hover { color: var(--kf-primary-dark); }

/* ---------------- Navbar / footer ---------------- */
.kf-navbar { background: var(--kf-primary); }
.kf-navbar .navbar-brand, .kf-navbar .nav-link { color: #fff !important; }
.kf-navbar .nav-link:hover { color: var(--kf-accent) !important; }
.kf-footer { background: var(--kf-primary-dark); color: #cdd8e3; }
.kf-footer a { color: #cdd8e3; text-decoration: none; }
.kf-footer a:hover { color: #fff; }

/* ---------------- Hero ---------------- */
.kf-hero {
    background: linear-gradient(135deg, var(--kf-primary) 0%, var(--kf-primary-dark) 100%);
}
.kf-hero .btn-light { color: var(--kf-primary); }
.kf-hero-forms .form-control { border: none; }

/* ---------------- Category tiles ---------------- */
.kf-category-tile {
    background: #fff;
    border: 1px solid #e6e9ee;
    border-radius: .75rem;
    padding: 1.25rem 1rem;
    color: var(--kf-primary);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    height: 100%;
    text-align: center;
}
.kf-category-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 .5rem 1rem rgba(31, 78, 121, .15);
    border-color: var(--kf-primary);
    color: var(--kf-primary-dark);
}

/* ---------------- Cards ---------------- */
.kf-page-header { background: var(--kf-bg-soft); border-bottom: 1px solid #e6e9ee; }
.kf-featured-section { background: var(--kf-bg-soft); }

.kf-card { border: none; border-radius: .75rem; overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.kf-card:hover { transform: translateY(-3px); box-shadow: 0 .75rem 1.5rem rgba(0,0,0,.12) !important; }
.kf-card-media {
    height: 150px;
    background: linear-gradient(135deg, #e9eef4, #d7e0ea);
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    color: #9fb2c6; font-size: 2.5rem;
}
.kf-card-title a, .stretched-link-title { color: var(--kf-primary); text-decoration: none; }
.kf-card-title a:hover { color: var(--kf-primary-dark); }

.kf-distance-badge, .kf-featured-badge {
    position: absolute; top: .5rem; font-size: .75rem; padding: .2rem .5rem;
    border-radius: 1rem; font-weight: 600;
}
.kf-distance-badge { left: .5rem; background: rgba(31,78,121,.9); color: #fff; }
.kf-featured-badge { right: .5rem; background: var(--kf-accent); color: #3a2c00; }

.kf-badge-category { background: #e7f0f8; color: var(--kf-primary); }

/* ---------------- Detail page ---------------- */
.kf-detail-hero { background: var(--kf-primary); background-size: cover; background-position: center; }
.kf-breadcrumb .breadcrumb-item a { color: #cdd8e3; }
.kf-breadcrumb .breadcrumb-item.active { color: #fff; }
.kf-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: #9fb2c6; }
.kf-detail-map { height: 340px; width: 100%; background: #e9eef4; }
.kf-detail-list li { margin-bottom: .75rem; display: flex; gap: .6rem; align-items: start; }
.kf-detail-list li i { width: 1.1rem; color: var(--kf-primary); margin-top: .2rem; }

/* ---------------- Full map page ---------------- */
.kf-map-page { display: flex; height: calc(100vh - 56px); }
.kf-map-sidebar { width: 360px; max-width: 40%; display: flex; flex-direction: column; border-right: 1px solid #e6e9ee; background: #fff; }
.kf-map-list { overflow-y: auto; flex: 1; }
.kf-map-canvas { flex: 1; position: relative; }
.kf-map-list-item { padding: .75rem 1rem; border-bottom: 1px solid #eef1f5; cursor: pointer; }
.kf-map-list-item:hover, .kf-map-list-item.active { background: var(--kf-bg-soft); }
.kf-map-list-item h6 { margin: 0 0 .2rem; color: var(--kf-primary); }
.kf-map-token-warning { position: absolute; top: 0; left: 0; right: 0; }

.kf-map-popup h6 { margin-bottom: .25rem; color: var(--kf-primary); }
.kf-map-popup .kf-popup-actions { display: flex; gap: .4rem; margin-top: .4rem; flex-wrap: wrap; }

@media (max-width: 768px) {
    .kf-map-page { flex-direction: column; height: auto; }
    .kf-map-sidebar { width: 100%; max-width: 100%; max-height: 45vh; }
    .kf-map-canvas { height: 55vh; }
}

/* ---------------- Admin ---------------- */
.kf-admin-shell { display: flex; min-height: calc(100vh - 56px); }
.kf-admin-nav { width: 240px; background: var(--kf-primary-dark); color: #cdd8e3; padding: 1rem 0; }
.kf-admin-nav a { display: block; color: #cdd8e3; padding: .6rem 1.25rem; text-decoration: none; }
.kf-admin-nav a:hover, .kf-admin-nav a.active { background: rgba(255,255,255,.08); color: #fff; border-left: 3px solid var(--kf-accent); }
.kf-admin-content { flex: 1; padding: 1.5rem; background: var(--kf-bg-soft); }
.kf-stat-card { border: none; border-radius: .75rem; }
.kf-stat-card .kf-stat-value { font-size: 2rem; font-weight: 700; color: var(--kf-primary); }

@media (max-width: 768px) {
    .kf-admin-shell { flex-direction: column; }
    .kf-admin-nav { width: 100%; display: flex; flex-wrap: wrap; }
    .kf-admin-nav a { flex: 1 1 auto; text-align: center; }
}

/* ---------------- Shul-specific accents ---------------- */
.kf-card-media--shul { background: linear-gradient(135deg, #e7e0f4, #d7d0ea); color: #8a7fb0; }
.kf-detail-hero--shul { background: #4b3f7a; }

/* ---------------- Homepage service hub ---------------- */
.kf-hub-hero {
    background: linear-gradient(135deg, var(--kf-primary) 0%, #3a2c66 100%);
    color: #fff;
}
.kf-service-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 992px) { .kf-service-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kf-service-grid { grid-template-columns: 1fr; } }

.kf-service-tile {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    background: #fff;
    border-radius: 1rem;
    text-decoration: none;
    color: var(--kf-primary);
    border: 1px solid #e6e9ee;
    transition: transform .14s ease, box-shadow .14s ease;
    min-height: 190px;
}
.kf-service-tile:hover { transform: translateY(-4px); box-shadow: 0 1rem 2rem rgba(31,78,121,.18); color: var(--kf-primary-dark); }
.kf-service-icon {
    width: 72px; height: 72px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; margin-bottom: 1rem; color: #fff;
}
.kf-service-icon--food { background: #1f7a4e; }
.kf-service-icon--shul { background: #4b3f7a; }
.kf-service-icon--market { background: #b8770f; }
.kf-service-icon--dating { background: #b0335b; }
.kf-service-tile h3 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.kf-service-tile p { font-size: .85rem; color: #6b7785; margin: .35rem 0 0; }
.kf-service-badge {
    position: absolute; top: .75rem; right: .75rem;
    font-size: .65rem; text-transform: uppercase; letter-spacing: .03em;
    background: #eef1f5; color: #6b7785; padding: .2rem .5rem; border-radius: 1rem; font-weight: 700;
}

/* Coming-soon pages */
.kf-coming-soon { min-height: 60vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.kf-coming-soon .kf-cs-icon { font-size: 3.5rem; color: var(--kf-primary); margin-bottom: 1rem; }

/* ---------------- Shidduchim swipe ---------------- */
.kf-swipe-page { background: linear-gradient(160deg, #fdf1f5 0%, #f3eefa 100%); min-height: calc(100vh - 56px); padding: 1rem 0 2rem; }
.kf-swipe-wrap { max-width: 420px; margin: 0 auto; padding: 0 1rem; }
.kf-swipe-controls { display: flex; justify-content: center; gap: .5rem; margin-bottom: .75rem; }

.kf-swipe-deck {
    position: relative;
    width: 100%;
    height: min(68vh, 560px);
    margin: 0 auto;
    touch-action: pan-y;
}
.kf-swipe-card {
    position: absolute; inset: 0;
    border-radius: 1.25rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 .75rem 2rem rgba(0,0,0,.18);
    user-select: none;
    -webkit-user-select: none;
    will-change: transform;
    cursor: grab;
    display: flex; flex-direction: column;
}
.kf-swipe-card.dragging { cursor: grabbing; transition: none; }
.kf-swipe-card.animate { transition: transform .35s ease, opacity .35s ease; }

.kf-swipe-photo {
    flex: 1;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    background-size: cover; background-position: center;
    color: rgba(255,255,255,.92);
}
.kf-swipe-initials { font-size: 4.5rem; font-weight: 800; letter-spacing: .05em; text-shadow: 0 2px 8px rgba(0,0,0,.25); }
.kf-swipe-info {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 3rem 1.15rem 1rem;
    background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.35) 60%, rgba(0,0,0,0) 100%);
    color: #fff;
}
.kf-swipe-info h2 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.kf-swipe-info .kf-swipe-meta { opacity: .9; font-size: .95rem; margin-top: .15rem; }
.kf-swipe-bio { font-size: .9rem; opacity: .95; margin: .5rem 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kf-swipe-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.kf-swipe-chip { background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35); color: #fff; font-size: .72rem; padding: .12rem .55rem; border-radius: 1rem; }

.kf-stamp {
    position: absolute; top: 1.25rem; font-size: 1.6rem; font-weight: 800;
    padding: .25rem .75rem; border-radius: .5rem; text-transform: uppercase;
    opacity: 0; transform: rotate(-12deg); letter-spacing: .05em;
}
.kf-stamp--like { left: 1rem; color: #1f7a4e; border: 3px solid #1f7a4e; transform: rotate(-16deg); }
.kf-stamp--nope { right: 1rem; color: #d23c3c; border: 3px solid #d23c3c; transform: rotate(16deg); }

.kf-swipe-actions { display: flex; justify-content: center; align-items: center; gap: 1.1rem; margin-top: 1.1rem; }
.kf-swipe-btn {
    width: 60px; height: 60px; border-radius: 50%; border: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; background: #fff; box-shadow: 0 .35rem .9rem rgba(0,0,0,.15);
    cursor: pointer; transition: transform .12s ease;
}
.kf-swipe-btn:hover { transform: scale(1.08); }
.kf-swipe-btn:active { transform: scale(.94); }
.kf-swipe-btn--nope { color: #d23c3c; }
.kf-swipe-btn--like { color: #1f7a4e; }
.kf-swipe-btn--rewind { color: #b8770f; width: 48px; height: 48px; font-size: 1.1rem; }
.kf-swipe-btn:disabled { opacity: .4; cursor: default; transform: none; }

.kf-swipe-empty { text-align: center; padding: 2rem 1rem; color: #6b7785; }
.kf-swipe-empty i { font-size: 3rem; color: var(--kf-primary); margin-bottom: 1rem; }

/* Match overlay */
.kf-match-overlay {
    position: fixed; inset: 0; z-index: 1080;
    background: rgba(31, 20, 40, .82);
    display: none; align-items: center; justify-content: center; text-align: center; padding: 1.5rem;
}
.kf-match-overlay.show { display: flex; }
.kf-match-card { color: #fff; max-width: 360px; animation: kfMatchPop .35s ease; }
.kf-match-card h2 { font-size: 2.4rem; font-weight: 800; background: linear-gradient(90deg,#ffd27d,#ff6f9c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.kf-match-avatars { display: flex; justify-content: center; align-items: center; gap: -10px; margin: 1rem 0; }
.kf-match-avatar { width: 92px; height: 92px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; color: #fff; border: 4px solid #fff; }
.kf-match-avatar + .kf-match-avatar { margin-left: -18px; }
@keyframes kfMatchPop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Role cards on the dating landing */
.kf-role-card { border: 1px solid #e6e9ee; border-radius: 1rem; height: 100%; }
.kf-role-card .kf-role-icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #fff; margin-bottom: .75rem; }
