/* =====================================================
   Spark Dating v3 — Style Meetic / Badoo (thème clair)
   ===================================================== */

/* ── Variables ── */
:root {
  --sp-rose:       #e8264a;
  --sp-rose-h:     #c9173a;
  --sp-rose-light: #fff0f3;
  --sp-rose-mid:   #ffd6dd;
  --sp-gold:       #f59e0b;
  --sp-green:      #22c55e;
  --sp-blue:       #3b82f6;
  --sp-white:      #ffffff;
  --sp-bg:         #f5f5f7;
  --sp-surf:       #ffffff;
  --sp-border:     #e5e5e5;
  --sp-border-h:   #cccccc;
  --sp-text:       #1a1a1a;
  --sp-muted:      #888888;
  --sp-radius:     14px;
  --sp-radius-lg:  20px;
}

/* ── Reset & Base ── */
#sp-app * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
#sp-app { display: flex; flex-direction: column; background: var(--sp-bg); color: var(--sp-text); border-radius: var(--sp-radius-lg); overflow: hidden; box-shadow: 0 4px 32px rgba(0,0,0,.1); margin: 24px auto; max-width: 1160px; min-height: 680px; max-height: 880px; height: 80vh; }

/* ── Header ── */
.sp-header { background: var(--sp-white); border-bottom: 1px solid var(--sp-border); padding: 0 24px; height: 62px; display: flex; align-items: center; gap: 0; flex-shrink: 0; z-index: 50; }
.sp-logo { font-size: 26px; font-weight: 800; color: var(--sp-rose); letter-spacing: -1px; margin-right: 28px; font-family: Georgia, 'Times New Roman', serif; cursor: pointer; flex-shrink: 0; }
.sp-logo span { color: var(--sp-text); }
.sp-nav { display: flex; gap: 2px; flex: 1; }
.sp-nav-btn { padding: 8px 16px; border: none; background: transparent; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--sp-muted); border-radius: 10px; transition: all .15s; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.sp-nav-btn:hover { background: var(--sp-rose-light); color: var(--sp-rose); }
.sp-nav-btn.active { background: var(--sp-rose-light); color: var(--sp-rose); }
.sp-badge { background: var(--sp-rose); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; min-width: 18px; text-align: center; display: none; }
.sp-badge.show { display: inline-block; }
.sp-header-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sp-notif-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--sp-border); background: var(--sp-white); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px; position: relative; }
.sp-notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--sp-rose); border-radius: 50%; border: 2px solid #fff; }
.sp-premium-btn { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; border: none; border-radius: 20px; padding: 7px 16px; font-size: 12px; font-weight: 700; cursor: pointer; transition: opacity .15s; }
.sp-premium-btn:hover { opacity: .9; }
.sp-avatar-hdr { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; border: 2px solid var(--sp-rose); cursor: pointer; flex-shrink: 0; }
.sp-avatar-hdr img { width: 100%; height: 100%; object-fit: cover; }

/* ── Body ── */
.sp-body { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ── */
.sp-sidebar { width: 260px; background: var(--sp-white); border-right: 1px solid var(--sp-border); padding: 20px 16px; overflow-y: auto; flex-shrink: 0; }
.sp-sidebar-title { font-size: 12px; font-weight: 700; color: var(--sp-muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 16px; }
.sp-filter-group { margin-bottom: 20px; }
.sp-filter-label { font-size: 12px; color: var(--sp-muted); margin-bottom: 8px; font-weight: 600; }
.sp-range-row { font-size: 13px; color: var(--sp-text); font-weight: 600; margin-bottom: 6px; }
.sp-range { width: 100%; accent-color: var(--sp-rose); margin-bottom: 4px; cursor: pointer; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-chip { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--sp-border); background: var(--sp-white); font-size: 12px; cursor: pointer; transition: all .15s; color: var(--sp-text); }
.sp-chip:hover { border-color: var(--sp-rose); color: var(--sp-rose); }
.sp-chip.active { background: var(--sp-rose-light); border-color: var(--sp-rose); color: var(--sp-rose); font-weight: 600; }
.sp-online-toggle { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--sp-bg); border-radius: 10px; font-size: 13px; color: var(--sp-text); font-weight: 500; }
.sp-toggle { width: 36px; height: 20px; background: var(--sp-border); border-radius: 20px; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; }
.sp-toggle.on { background: var(--sp-rose); }
.sp-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.sp-toggle.on::after { left: 18px; }
.sp-apply-btn { width: 100%; padding: 11px; background: var(--sp-rose); color: #fff; border: none; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; margin-top: 8px; transition: background .15s; }
.sp-apply-btn:hover { background: var(--sp-rose-h); }

/* ── Main ── */
.sp-main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.sp-view { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.sp-view--active { display: flex; }
.sp-view--msg { flex-direction: row !important; }
.sp-loading-msg { color: var(--sp-muted); font-size: 14px; padding: 32px; text-align: center; }

/* ── VUE DÉCOUVRIR ── */
#sp-view-discover { padding: 20px 22px; overflow-y: auto; }
.sp-view-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-shrink: 0; }
.sp-view-title { font-size: 18px; font-weight: 700; color: var(--sp-text); }
.sp-sort-sel { padding: 7px 12px; border: 1px solid var(--sp-border); border-radius: 8px; font-size: 13px; color: var(--sp-text); background: var(--sp-white); cursor: pointer; outline: none; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 16px; }

/* Cards */
.sp-card { background: var(--sp-white); border-radius: var(--sp-radius-lg); overflow: hidden; cursor: pointer; border: 1px solid var(--sp-border); transition: transform .18s, box-shadow .18s; }
.sp-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0,0,0,.1); }
.sp-card-photo { position: relative; aspect-ratio: .8; overflow: hidden; background: #f0e8f0; }
.sp-card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-card-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 52px; font-weight: 700; color: var(--sp-white); }
.sp-online-dot { position: absolute; bottom: 10px; left: 10px; width: 12px; height: 12px; background: var(--sp-green); border: 2px solid #fff; border-radius: 50%; }
.sp-card-actions { position: absolute; bottom: 10px; right: 10px; display: flex; gap: 6px; opacity: 0; transition: opacity .18s; }
.sp-card:hover .sp-card-actions { opacity: 1; }
.sp-card-act { width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: transform .15s; }
.sp-card-act:hover { transform: scale(1.12); }
.sp-card-act-like { background: var(--sp-rose); color: #fff; }
.sp-card-act-msg  { background: rgba(255,255,255,.92); color: var(--sp-text); }
.sp-card-act-fav  { background: rgba(255,255,255,.92); color: var(--sp-gold); }
.sp-card-body { padding: 12px; }
.sp-card-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.sp-card-meta { font-size: 12px; color: var(--sp-muted); }
.sp-card-bdgs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.sp-bdg { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.sp-bdg-online   { background: #dcfce7; color: #16a34a; }
.sp-bdg-new      { background: #fef3c7; color: #d97706; }
.sp-bdg-verified { background: #eff6ff; color: #2563eb; }
.sp-bdg-super    { background: #fdf4ff; color: #9333ea; }

/* ── VUE SWIPE ── */
#sp-view-swipe { align-items: center; justify-content: center; background: var(--sp-bg); padding: 20px; }
.sp-swipe-count { font-size: 13px; color: var(--sp-muted); margin-bottom: 14px; }
.sp-swipe-wrap { position: relative; width: min(340px, 85vw); height: min(480px, 70vw); max-height: 480px; margin-bottom: 24px; }
.sp-swipe-card { position: absolute; inset: 0; border-radius: var(--sp-radius-lg); overflow: hidden; cursor: grab; background: #eee; box-shadow: 0 8px 32px rgba(0,0,0,.12); border: 1px solid var(--sp-border); }
.sp-swipe-card:active { cursor: grabbing; }
.sp-swipe-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-swipe-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.78) 0%, transparent 55%); display: flex; flex-direction: column; justify-content: flex-end; padding: 20px; }
.sp-swipe-name { font-size: 26px; font-weight: 800; color: #fff; }
.sp-swipe-sub  { font-size: 13px; color: rgba(255,255,255,.75); margin-top: 2px; }
.sp-swipe-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.sp-swipe-tag  { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28); padding: 3px 9px; border-radius: 20px; font-size: 11px; color: #fff; }
.sp-swipe-ind  { position: absolute; top: 22px; padding: 6px 14px; border-radius: 9px; font-weight: 800; font-size: 17px; letter-spacing: 2px; opacity: 0; pointer-events: none; border: 3px solid; }
.sp-ind-like { left: 14px; color: #22c55e; border-color: #22c55e; transform: rotate(-8deg); }
.sp-ind-nope { right: 14px; color: var(--sp-rose); border-color: var(--sp-rose); transform: rotate(8deg); }
.sp-card-back1 { transform: rotate(2deg) translateY(8px) scale(.97); z-index: 0; }
.sp-card-back2 { transform: rotate(-2deg) translateY(16px) scale(.94); z-index: -1; }
.sp-swipe-btns { display: flex; gap: 18px; align-items: center; }
.sp-swipe-btn { border: none; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.sp-swipe-btn:hover { transform: scale(1.1); }
.sp-btn-nope  { width: 58px; height: 58px; background: var(--sp-white); color: var(--sp-rose); font-size: 22px; border: 2px solid var(--sp-rose); box-shadow: 0 3px 12px rgba(232,38,74,.15); }
.sp-btn-msg   { width: 48px; height: 48px; background: var(--sp-white); color: var(--sp-blue); font-size: 18px; border: 2px solid var(--sp-blue); box-shadow: 0 3px 12px rgba(59,130,246,.15); }
.sp-btn-like  { width: 70px; height: 70px; background: var(--sp-rose); color: #fff; font-size: 28px; border: none; box-shadow: 0 6px 20px rgba(232,38,74,.35); }
.sp-btn-super { width: 48px; height: 48px; background: var(--sp-white); color: var(--sp-gold); font-size: 18px; border: 2px solid var(--sp-gold); box-shadow: 0 3px 12px rgba(245,158,11,.15); }

/* ── VUE LIKES ── */
#sp-view-likes { padding: 20px 22px; overflow-y: auto; }
.sp-likes-banner { background: linear-gradient(135deg, var(--sp-rose), #f97316); border-radius: var(--sp-radius-lg); padding: 26px 28px; color: #fff; margin-bottom: 18px; }
.sp-likes-banner h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.sp-likes-banner p  { font-size: 13px; opacity: .88; }
.sp-likes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; }
.sp-like-card  { border-radius: var(--sp-radius); overflow: hidden; aspect-ratio: .78; position: relative; cursor: pointer; background: #f0e8f0; transition: transform .18s; }
.sp-like-card:hover { transform: scale(1.03); }
.sp-like-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-like-blur  { position: absolute; inset: 0; backdrop-filter: blur(12px) brightness(.65); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.sp-like-heart { position: absolute; top: 10px; right: 10px; background: var(--sp-rose); color: #fff; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.sp-like-name  { position: absolute; bottom: 0; left: 0; right: 0; padding: 10px 12px; background: linear-gradient(to top, rgba(0,0,0,.78), transparent); color: #fff; font-weight: 700; font-size: 13px; }

/* ── VUE MESSAGES ── */
.sp-msg-list { width: 290px; flex-shrink: 0; background: var(--sp-white); border-right: 1px solid var(--sp-border); display: flex; flex-direction: column; overflow: hidden; }
.sp-msg-list-hdr { padding: 18px 16px 12px; border-bottom: 1px solid var(--sp-border); }
.sp-msg-list-hdr h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.sp-search-wrap { position: relative; }
.sp-search-wrap::before { content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; pointer-events: none; }
.sp-search-input { width: 100%; padding: 8px 12px 8px 32px; border: 1px solid var(--sp-border); border-radius: 20px; font-size: 13px; background: var(--sp-bg); outline: none; }
.sp-search-input:focus { border-color: var(--sp-rose); }
.sp-threads { flex: 1; overflow-y: auto; }
.sp-thread { display: flex; gap: 10px; padding: 12px 16px; cursor: pointer; transition: background .12s; align-items: center; border-bottom: 1px solid #fafafa; }
.sp-thread:hover { background: var(--sp-rose-light); }
.sp-thread.active { background: var(--sp-rose-light); }
.sp-thread-av { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex-shrink: 0; position: relative; background: #f0e8f0; }
.sp-thread-av img { width: 100%; height: 100%; object-fit: cover; }
.sp-thread-online { position: absolute; bottom: 1px; right: 1px; width: 11px; height: 11px; background: var(--sp-green); border: 2px solid #fff; border-radius: 50%; }
.sp-thread-info { flex: 1; min-width: 0; }
.sp-thread-top  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.sp-thread-name { font-weight: 700; font-size: 14px; }
.sp-thread-time { font-size: 11px; color: var(--sp-muted); }
.sp-thread-prev { font-size: 12px; color: var(--sp-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-thread-unread { width: 18px; height: 18px; background: var(--sp-rose); border-radius: 50%; font-size: 10px; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Chat */
.sp-chat { flex: 1; display: flex; flex-direction: column; background: var(--sp-bg); }
.sp-chat-hdr { background: var(--sp-white); padding: 14px 18px; border-bottom: 1px solid var(--sp-border); display: flex; align-items: center; gap: 12px; }
.sp-chat-hdr-av { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: #f0e8f0; }
.sp-chat-hdr-av img { width: 100%; height: 100%; object-fit: cover; }
.sp-chat-hdr-name { font-weight: 700; font-size: 15px; }
.sp-chat-hdr-status { font-size: 12px; color: var(--sp-green); }
.sp-chat-hdr-acts { margin-left: auto; display: flex; gap: 8px; }
.sp-chat-hdr-btn { width: 34px; height: 34px; border: 1px solid var(--sp-border); background: var(--sp-white); border-radius: 8px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: background .12s; }
.sp-chat-hdr-btn:hover { background: var(--sp-bg); }
.sp-chat-feed { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sp-msg-row { display: flex; gap: 7px; max-width: 72%; }
.sp-msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.sp-bubble { padding: 10px 14px; border-radius: 16px; font-size: 13px; line-height: 1.55; }
.sp-msg-row.theirs .sp-bubble { background: var(--sp-white); border: 1px solid var(--sp-border); border-bottom-left-radius: 4px; }
.sp-msg-row.mine   .sp-bubble { background: var(--sp-rose); color: #fff; border-bottom-right-radius: 4px; }
.sp-msg-av { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex-shrink: 0; align-self: flex-end; background: #f0e8f0; }
.sp-msg-av img { width: 100%; height: 100%; object-fit: cover; }
.sp-msg-time { font-size: 10px; color: var(--sp-muted); align-self: flex-end; padding: 0 3px; }
.sp-date-sep { text-align: center; font-size: 11px; color: var(--sp-muted); padding: 4px 0; }
.sp-chat-input-area { background: var(--sp-white); padding: 12px 16px; border-top: 1px solid var(--sp-border); display: flex; gap: 10px; align-items: flex-end; }
.sp-chat-input { flex: 1; background: var(--sp-bg); border: 1px solid var(--sp-border); border-radius: 20px; padding: 10px 16px; font-size: 13px; font-family: inherit; resize: none; outline: none; min-height: 40px; max-height: 100px; line-height: 1.4; transition: border-color .15s; }
.sp-chat-input:focus { border-color: var(--sp-rose); background: var(--sp-white); }
.sp-send-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--sp-rose); border: none; cursor: pointer; color: #fff; font-size: 15px; display: flex; align-items: center; justify-content: center; transition: background .15s; flex-shrink: 0; }
.sp-send-btn:hover { background: var(--sp-rose-h); }
.sp-no-chat { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--sp-muted); }
.sp-no-chat-icon { font-size: 44px; opacity: .25; }

/* ── Match Popup ── */
.sp-match-overlay { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.65); backdrop-filter: blur(6px); align-items: center; justify-content: center; }
.sp-match-overlay.show { display: flex; }
.sp-match-box { background: var(--sp-white); border-radius: 24px; padding: 40px 32px; max-width: 350px; width: 92%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.2); animation: spMatchPop .38s cubic-bezier(.34,1.56,.64,1); }
.sp-match-confetti { font-size: 32px; margin-bottom: 6px; display: inline-block; animation: spConfetti .8s infinite; }
.sp-match-title { font-size: 32px; font-weight: 800; background: linear-gradient(135deg, var(--sp-rose), #f97316); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 6px; }
.sp-match-sub   { font-size: 14px; color: var(--sp-muted); margin-bottom: 22px; }
.sp-match-faces { display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 22px; }
.sp-match-face  { width: 70px; height: 70px; border-radius: 50%; overflow: hidden; border: 3px solid var(--sp-rose); background: #f0e8f0; margin: 0 -6px; }
.sp-match-face img { width: 100%; height: 100%; object-fit: cover; }
.sp-match-heart { font-size: 20px; animation: spHeart .8s infinite; z-index: 1; position: relative; }
.sp-match-btn   { display: block; width: 100%; padding: 13px; border-radius: 12px; border: none; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all .15s; margin-top: 8px; }
.sp-match-btn--p { background: var(--sp-rose); color: #fff; }
.sp-match-btn--p:hover { background: var(--sp-rose-h); }
.sp-match-btn--s { background: var(--sp-bg); color: var(--sp-muted); border: 1px solid var(--sp-border); }

/* ── Login wall ── */
.sp-login-wall { text-align: center; padding: 48px 28px; background: var(--sp-white); border-radius: 20px; max-width: 420px; margin: 32px auto; border: 1px solid var(--sp-border); box-shadow: 0 4px 20px rgba(0,0,0,.06); }
.sp-login-icon { font-size: 48px; margin-bottom: 12px; }
.sp-login-wall h3 { font-size: 24px; font-weight: 800; color: var(--sp-rose); margin-bottom: 8px; }
.sp-login-wall p { color: var(--sp-muted); margin-bottom: 22px; font-size: 14px; }
.sp-btn-login, .sp-btn-register { display: inline-block; margin: 6px; padding: 12px 26px; border-radius: 12px; text-decoration: none; font-weight: 700; font-size: 14px; transition: all .15s; }
.sp-btn-login    { background: var(--sp-rose); color: #fff; }
.sp-btn-login:hover    { background: var(--sp-rose-h); color: #fff; }
.sp-btn-register { background: var(--sp-bg); color: var(--sp-text); border: 1px solid var(--sp-border); }
.sp-btn-register:hover { border-color: var(--sp-rose); color: var(--sp-rose); }

/* ── Swipe animations ── */
.sp-exit-r { animation: spExitR .38s ease-in forwards; }
.sp-exit-l { animation: spExitL .38s ease-in forwards; }
@keyframes spExitR   { to { transform: translateX(140%) rotate(28deg); opacity: 0; } }
@keyframes spExitL   { to { transform: translateX(-140%) rotate(-28deg); opacity: 0; } }
@keyframes spMatchPop{ from { transform: scale(.55); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes spHeart   { 0%,100% { transform: scale(1); } 50% { transform: scale(1.35); } }
@keyframes spConfetti{ 0%,100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.2) rotate(10deg); } }

/* ── Responsive ── */
@media (max-width: 720px) {
  #sp-app { height: 100svh; border-radius: 0; margin: 0; max-width: 100%; }
  .sp-sidebar { display: none !important; }
  .sp-nav-btn { padding: 6px 10px; font-size: 12px; }
  .sp-logo { margin-right: 10px; }
  .sp-premium-btn { display: none; }
  .sp-msg-list { width: 100%; }
  .sp-chat { display: none; }
  .sp-msg-list.chat-open { display: none; }
  .sp-chat.chat-open { display: flex; width: 100%; }
}
