/* contacts.css — FULL DROP-IN (keeps your entire file intact)
   ✅ I did NOT remove/alter any non-modal styling.
   ✅ I ONLY replaced the CALL MODALS section with a scoped + centered version
      for #incomingCallModal and #callingModal (Bootstrap markup).
   ✅ Fixes:
      - Modals ALWAYS centered (desktop + mobile)
      - Backdrop covers full screen
      - Modals do NOT appear on page load unless Bootstrap shows them
      - Keeps your green/blue header bar logic + custom X rendering
*/

/* contacts.css — FULL DROP-IN (restores ORIGINAL call modal styling)
   ✅ Keeps all your existing contacts list + chips + cl-* modals + dropdown + lookup menu
   ✅ Fixes BOTH outgoing + incoming call modals:
      - full-width colored header bar (voice=green, video=blue)
      - proper icon + title alignment
      - close (X) locked top-right inside the bar
      - incoming footer buttons wide + consistent
*/

:root{
  --bg:#f5f6f8;
  --white:#fff;
  --ink:#1f2837;
  --muted:#6b7280;
  --divider:#eceff4;
  --chip-blue:#4f8cff;
  --chip-amber:#f39c12;
  --chip-teal:#20c997;
  --chip-gray:#8c939b;
  --surface:#fff;
  --shadow:0 8px 28px rgba(16,24,40,.10);
  --radius-card:22px;

  /* Call modal palette (matches your “original” screenshots) */
  --modal-green:#20c997;
  --modal-blue:#0d6efd;
  --modal-danger:#dc3545;
  --modal-success:#198754;
  --modal-border:#eef1f4;
  --modal-shadow:0 24px 60px rgba(16,24,40,.20);
  --modal-radius:16px;

  /* New refinements (safe) */
  --modal-ink:#0f172a;
  --modal-muted:#64748b;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font:16px/1.45 system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial,"Noto Sans","Apple Color Emoji hookup","Segoe UI Emoji","Segoe UI Symbol";
}

/* =========================
   Top bar
========================= */
.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px;
  background:var(--white);
  border-bottom:1px solid var(--divider);
}
.title{font-size:22px;font-weight:700;letter-spacing:.2px}
.iconbtn{
  background:transparent;
  border:none;
  padding:0;
  margin:0 4px;
  cursor:pointer;
  width:34px;
  height:34px;
  border-radius:999px;
  display:grid;
  place-items:center;
}
.iconbtn:hover{background:#f0f2f6}
.icon{width:22px;height:22px;fill:#263238}

/* Requests badge – scoped to the bell only */
.iconbtn.notifbtn{position:relative}
.iconbtn.notifbtn .badge{
  position:absolute;
  top:-4px; right:-4px;
  min-width:18px; height:18px;
  padding:0 5px;
  border-radius:999px;
  background:#ef4444;
  color:#fff;
  font-size:12px;
  line-height:18px;
  text-align:center;
  font-weight:800;
  box-shadow:0 4px 10px rgba(239,68,68,.25);
}

/* Account dropdown */
.topbar .actions{display:flex;align-items:center;gap:12px}
.account-wrap{position:relative}
.account-menu{
  position:absolute;
  right:0;
  top:calc(100% + 10px);
  min-width:220px;
  background:#fff;
  border:1px solid var(--divider,#e5e7eb);
  border-radius:12px;
  box-shadow:0 10px 30px rgba(0,0,0,.08);
  padding:10px;
  z-index:1000;
}
.account-menu::before{
  content:"";
  position:absolute;
  right:14px;
  top:-6px;
  width:10px;height:10px;
  background:#fff;
  border-left:1px solid var(--divider,#e5e7eb);
  border-top:1px solid var(--divider,#e5e7eb);
  transform:rotate(45deg);
}
.account-menu .btn{width:100%}

/* =========================
   Search (scoped buttons)
========================= */
.search-wrap{
  display:none;
  padding:10px 12px;
  background:var(--white);
  border-bottom:1px solid var(--divider);
}
.search{
  display:flex;
  gap:8px;
  background:#fff;
  border:1px solid var(--divider);
  border-radius:12px;
  padding:10px 12px;
}
.search input{flex:1 1 auto;border:0;outline:0;font:inherit}

/* Search buttons only (do NOT override modal buttons) */
.search .btn{
  border:1px solid var(--divider);
  background:#fff;
  border-radius:10px;
  padding:6px 10px;
  cursor:pointer;
}
.search .btn:hover{background:#f7f8fb}

/* =========================
   List
========================= */
.list{list-style:none;padding:0;margin:0;background:var(--white)}
.item{border-bottom:1px solid var(--divider)}

/* Row */
.head{
  width:100%;
  border:0;
  outline:0;
  background:#fff;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  text-align:left;
}
.head:hover{background:#f7f8fb}
.avatar{
  width:36px;height:36px;border-radius:999px;
  display:grid;place-items:center;
  color:#415068;background:#e9eef5;
  overflow:hidden;
  flex:0 0 36px;
  font-weight:700;
  position:relative;
}
.avatar img{width:100%;height:100%;object-fit:cover;display:block}
.name{
  flex:1 1 auto;
  font-weight:600;
  color:var(--ink);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Status dot */
.avatar::after{
  content:"";
  position:absolute;
  right:-1px;
  bottom:-1px;
  width:10px;height:10px;
  border-radius:50%;
  border:2px solid #fff;
  background:#9ca3af;
}
.item[data-status="online"]  .avatar::after{background:#22c55e}
.item[data-status="offline"] .avatar::after{background:#ef4444}
.item[data-status="away"]    .avatar::after{background:#f59e0b}

/* Expanded card */
.body{display:none;padding:0 12px 14px 12px;background:var(--bg)}
.card{
  margin-top:10px;
  border-radius:var(--radius-card);
  background:var(--surface);
  border:1px solid #eef1f4;
  box-shadow:var(--shadow);
  padding:16px;
}
.card .header{display:flex;align-items:center;gap:14px;margin-bottom:10px}
.card .photo{
  width:44px;height:44px;border-radius:999px;
  background:#e9eef5;
  object-fit:cover;
}
.card .title{font-weight:800}
.card .number{font-weight:600}
.card .number span{color:var(--muted);font-weight:500}

.actions{display:flex;gap:16px;padding-top:8px}
.chip{
  width:56px;height:56px;border-radius:999px;
  border:0;color:#fff;
  display:grid;place-items:center;
  cursor:pointer;
  box-shadow:0 10px 22px rgba(0,0,0,.15);
  transition:transform .12s ease, filter .12s ease;
}
.chip:hover{transform:scale(1.06);filter:brightness(1.05)}
.chip svg{width:24px;height:24px;fill:#fff}
.chip.call{background:var(--chip-teal)}
.chip.video{background:var(--chip-blue)}
.chip.chat{background:var(--chip-amber)}
.chip.info{background:var(--chip-gray)}

.footer{height:24px}
@media (max-width:576px){.chip{width:52px;height:52px}}

.item.open .body{display:block}
.item.open .head{background:#f7f8fb}

/* =========================
   cl-* Modals (your custom add/info)
========================= */
.cl-backdrop{
  position:fixed; inset:0;
  background:rgba(0,0,0,.35);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:1000;
  padding:16px;
}
.cl-backdrop.show{display:flex}
.cl-backdrop[aria-hidden="true"]{display:none}
.cl-backdrop[aria-hidden="false"]{display:flex}

.cl-modal{
  width:100%;
  max-width:520px;
  background:#fff;
  border-radius:16px;
  box-shadow:0 24px 60px rgba(16,24,40,.2);
  border:1px solid #eef1f4;
  padding:20px 18px 16px;
  position:relative;
}
.cl-title{margin:0 0 12px;font-size:20px;font-weight:700}
.cl-close{
  position:absolute;right:10px;top:8px;
  width:32px;height:32px;
  border-radius:8px;border:0;
  background:transparent;
  font-size:22px;line-height:1;
  cursor:pointer;
}
.cl-close:hover{background:#f3f4f6}
.cl-form{display:grid;gap:12px}
.cl-field{display:grid;gap:6px}
.cl-field>span{font-weight:600;color:#1f2937}
.cl-field input{
  width:100%;
  padding:10px 12px;
  border:1px solid #e5e7eb;
  border-radius:10px;
  font:inherit;
  color:#111827;
  background:#fff;
}
.cl-field input:focus{
  outline:0;
  border-color:#4f8cff;
  box-shadow:0 0 0 3px rgba(79,140,255,.15);
}
.cl-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:6px}
.cl-btn{
  border:1px solid #e5e7eb;
  background:#fff;
  border-radius:10px;
  padding:8px 14px;
  cursor:pointer;
}
.cl-btn:hover{background:#f7f8fb}
.cl-primary{
  background:#4f8cff;
  color:#fff;
  border-color:#4f8cff;
  box-shadow:0 6px 16px rgba(79,140,255,.25);
}
.cl-primary:hover{filter:brightness(1.05)}
.cl-ghost{background:#fff;color:#111827}
@media (max-width:480px){.cl-modal{padding:18px 14px 14px;border-radius:14px}}

.cl-info{display:grid;gap:8px;margin:10px 0 6px}
.cl-row{display:flex;align-items:baseline;gap:10px}
.cl-label{min-width:92px;font-weight:600;color:#1f2937}
.cl-value{color:#111827;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}

/* =========================
   Bootstrap-ish buttons (global)
========================= */
.btn{
  display:inline-block;
  font-weight:400;
  line-height:1.5;
  text-align:center;
  text-decoration:none;
  vertical-align:middle;
  cursor:pointer;
  user-select:none;
  border:1px solid transparent;
  padding:.375rem .75rem;
  font-size:1rem;
  border-radius:.375rem;
  transition:color .15s ease-in-out,
             background-color .15s ease-in-out,
             border-color .15s ease-in-out,
             box-shadow .15s ease-in-out;
}
.btn:disabled,.btn.disabled{pointer-events:none;opacity:.65}

.btn-light{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}
.btn-light:hover{color:#212529;background-color:#e2e6ea;border-color:#dae0e5}

.btn-primary{color:#fff;background-color:var(--modal-blue);border-color:var(--modal-blue)}
.btn-primary:hover{color:#fff;background-color:#0b5ed7;border-color:#0a58ca}

.btn-danger{color:#fff;background-color:var(--modal-danger);border-color:var(--modal-danger)}
.btn-danger:hover{color:#fff;background-color:#bb2d3b;border-color:#b02a37}

.btn-sm{padding:.25rem .5rem;font-size:.875rem;border-radius:.25rem}
.btn-lg{padding:.5rem 1rem;font-size:1.25rem;border-radius:.5rem}

/* Outline danger (Decline) */
.btn-outline-danger{
  color:var(--modal-danger);
  background:#fff;
  border-color:var(--modal-danger);
}
.btn-outline-danger:hover{
  color:#fff;
  background:var(--modal-danger);
  border-color:var(--modal-danger);
}

/* Success (Accept) */
.btn-success{
  color:#fff;
  background:var(--modal-success);
  border-color:var(--modal-success);
}
.btn-success:hover{
  color:#fff;
  background:#157347;
  border-color:#146c43;
}

/* =========================
   Lookup / menus (unchanged)
========================= */
.lookup-results{
  margin-top:6px;
  border:1px solid var(--divider,#e5e7eb);
  border-radius:10px;
  max-height:240px;
  overflow-y:auto;
  background:#fff;
}
.lookup-results .hint{padding:10px 12px;opacity:.75;background:#fafafa}
.lookup-results button{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
  padding:10px 12px;
  background:#fff;
  border:0;
  border-bottom:1px solid #eee;
  cursor:pointer;
  text-align:left;
}
.lookup-results button:last-child{border-bottom:0}
.lookup-results .pill{
  margin-left:auto;
  font-size:12px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid #e5e7eb;
  background:#f9fafb;
}
.lookup-results .selected{background:#eff6ff}

.empty-hint{
  margin:12px 8px;
  padding:10px 15px;
  border:1px dashed var(--divider,#e5e7eb);
  border-radius:8px;
  color:#6b7280;
  background:#fafafa;
}

.contact-menu{
  position:absolute;
  z-index:1000;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:10px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
  overflow:hidden;
  min-width:180px;
}
.contact-menu button{
  display:block;
  width:100%;
  text-align:left;
  padding:10px 12px;
  border:0;
  background:#fff;
  cursor:pointer;
}
.contact-menu button:hover{background:#f3f4f6}

.chip[aria-disabled="true"]{opacity:.45;pointer-events:none}


/* =========================================================
   CALL MODALS — SCOPED + CENTERED (2026-02-12)
   IMPORTANT: scoped ONLY to #incomingCallModal and #callingModal
   so we don't accidentally affect other Bootstrap modals elsewhere.
========================================================= */

/* Full-screen backdrop + CENTERING (fixes your "left side" issue) */
#incomingCallModal,
#callingModal{
  position:fixed;
  inset:0;
  z-index:1100;
  background:rgba(0,0,0,.40);
  padding:16px;

  /* Center dialog */
  display:none;
  align-items:center;
  justify-content:center;

  /* safety */
  overflow:auto;
}

/* Hidden means hidden (even if something toggles classes briefly) */
#incomingCallModal[aria-hidden="true"],
#callingModal[aria-hidden="true"]{
  display:none !important;
}

/* Bootstrap will add .show when opened */
#incomingCallModal.show,
#callingModal.show,
#incomingCallModal[aria-hidden="false"],
#callingModal[aria-hidden="false"]{
  display:flex !important;
}

/* Dialog sizing (allow inline max-width to win, but keep it responsive) */
#incomingCallModal .modal-dialog,
#callingModal .modal-dialog{
  width:100%;
  margin:0;                 /* centering handled by flex */
  pointer-events:none;      /* like Bootstrap: clicks outside hit backdrop */
}
#incomingCallModal .modal-dialog > .modal-content,
#callingModal .modal-dialog > .modal-content{
  pointer-events:auto;
}

/* Content */
#incomingCallModal .modal-content,
#callingModal .modal-content{
  width:100%;
  background:#fff;
  border-radius:var(--modal-radius);
  border:1px solid var(--modal-border);
  box-shadow:var(--modal-shadow);
  overflow:hidden; /* keeps header bar corners clean */
}

/* Pop-in animation */
#incomingCallModal.show .modal-content,
#callingModal.show .modal-content{
  animation:clModalPop .14s ease-out both;
}
@keyframes clModalPop{
  from{transform:translateY(10px) scale(.99);opacity:0}
  to{transform:translateY(0) scale(1);opacity:1}
}

/* Section padding */
#incomingCallModal .modal-header,
#incomingCallModal .modal-body,
#incomingCallModal .modal-footer,
#callingModal .modal-header,
#callingModal .modal-body,
#callingModal .modal-footer{
  padding:16px 18px;
}

/* HEADER BAR */
#incomingCallModal .modal-header,
#callingModal .modal-header{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border:0;
  padding:14px 18px;
  background:var(--modal-blue); /* default */
  color:#fff;
}
#incomingCallModal .modal-header.is-voice,
#callingModal .modal-header.is-voice{ background:var(--modal-green); }
#incomingCallModal .modal-header.is-video,
#callingModal .modal-header.is-video{ background:var(--modal-blue); }

/* Title row */
#incomingCallModal .modal-title,
#callingModal .modal-title{
  margin:0;
  color:#fff;
  font-weight:800;
  font-size:18px;
  display:flex;
  align-items:center;
  gap:10px;
  letter-spacing:.2px;
}

/* Icon badge */
#incomingCallModal .modal-icon,
#callingModal .modal-icon,
#callingModal #callingIcon,
#incomingCallModal #incomingCallIcon{
  width:34px;height:34px;
  border-radius:999px;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.18);
}

/* Close button (custom-drawn X so it always shows) */
#incomingCallModal .btn-close,
#callingModal .btn-close{
  position:absolute;
  right:12px;
  top:10px;

  width:36px;
  height:36px;
  border-radius:12px;

  border:1px solid rgba(255,255,255,.24);
  background:rgba(255,255,255,.14);
  color:#fff;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  opacity:1;
  cursor:pointer;
  padding:0;
  margin:0;
  line-height:1;
  user-select:none;

  /* kill any bootstrap background-image assumptions */
  background-image:none !important;
}
#incomingCallModal .btn-close::before,
#incomingCallModal .btn-close::after,
#callingModal .btn-close::before,
#callingModal .btn-close::after{
  content:"";
  position:absolute;
  width:16px;
  height:2px;
  background:#fff;
  border-radius:2px;
}
#incomingCallModal .btn-close::before,
#callingModal .btn-close::before{ transform:rotate(45deg); }
#incomingCallModal .btn-close::after,
#callingModal .btn-close::after{ transform:rotate(-45deg); }

#incomingCallModal .btn-close:hover,
#callingModal .btn-close:hover{
  background:rgba(255,255,255,.22);
  border-color:rgba(255,255,255,.32);
}

/* Body */
#incomingCallModal .modal-body,
#callingModal .modal-body{
  background:#fff;
  color:var(--modal-ink);
}

/* Incoming text (override inline styles gently) */
#incomingCallModal #callTypeText{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background:#f1f5f9;
  border:1px solid #e2e8f0;
  color:var(--modal-muted);
  font-size:13px;
  margin-bottom:8px;
}
#incomingCallModal #callerName{
  font-weight:900;
  font-size:20px;
  letter-spacing:.2px;
  margin-top:2px;
  color:var(--modal-ink);
}
#incomingCallModal #callExtraText{
  color:#475569;
  font-size:14px;
}

/* Outgoing name */
#callingModal #callingName{
  font-weight:900;
  font-size:20px;
  letter-spacing:.2px;
  color:var(--modal-ink);
}

/* INCOMING: footer buttons */
#incomingCallModal .modal-footer{
  display:flex;
  gap:14px;
  justify-content:space-between;
  padding:14px 18px 18px;
  border-top:0;
  background:#fff;
}
#incomingCallModal #declineCallBtn,
#incomingCallModal #acceptCallBtn{
  flex:1 1 0;
  height:46px;
  padding:0 16px;
  border-radius:12px;
  font-weight:900;
  font-size:16px;
  cursor:pointer;
}

/* Decline */
#incomingCallModal #declineCallBtn{
  background:#fff;
  color:var(--modal-danger);
  border:1px solid #fca5a5;
  box-shadow:0 10px 22px rgba(220,53,69,.10);
}
#incomingCallModal #declineCallBtn:hover{
  background:#fff5f5;
  border-color:#fb7185;
}

/* Accept */
#incomingCallModal #acceptCallBtn{
  background:var(--modal-success);
  color:#fff;
  border:1px solid var(--modal-success);
  box-shadow:0 14px 34px rgba(25,135,84,.22);
}
#incomingCallModal #acceptCallBtn:hover{
  background:#157347;
  border-color:#146c43;
}

/* CALLING: footer + cancel */
#callingModal .modal-footer{
  display:flex;
  justify-content:flex-end;
  padding:14px 18px 18px;
  border-top:0;
  background:#fff;
}
#callingModal #cancelCallBtn{
  min-width:120px;
  height:44px;
  border-radius:12px;
  border:1px solid #e2e8f0;
  background:#fff;
  font-weight:800;
  box-shadow:0 10px 22px rgba(2,6,23,.06);
}
#callingModal #cancelCallBtn:hover{background:#f8fafc}

/* Mobile */
@media (max-width:480px){
  #incomingCallModal,
  #callingModal{padding:12px}
  #incomingCallModal #declineCallBtn,
  #incomingCallModal #acceptCallBtn{font-size:15px}
}

/* =========================================================
   FINAL OUTGOING MODAL FIXES (2026-02-12)
========================================================= */

/* 1️⃣ Make "Calling Alice" fully white (override global text color) */
#callingModal .modal-header,
#callingModal .modal-header * {
  color: #fff !important;
}

/* Specifically ensure name inside title stays white */
#callingModal #callingTitle,
#callingModal #callingTitle span,
#callingModal #callingName {
  color: #fff !important;
}

/* 2️⃣ Proper outlined Cancel button (Bootstrap outline-secondary equivalent) */
#callingModal .btn-outline-secondary {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #111827;
  border-radius: 12px;
  height: 44px;
  font-weight: 800;
  min-width: 120px;
  box-shadow: 0 10px 22px rgba(2,6,23,.06);
  transition: all .15s ease;
}

#callingModal .btn-outline-secondary:hover {
  background: #f3f4f6;
  border-color: #cbd5e1;
}

/* Ensure footer spacing matches incoming modal */
#callingModal .modal-footer {
  justify-content: flex-end;
  gap: 12px;
  border-top: 0;
  padding: 14px 18px 18px;
}

/* OUTGOING CANCEL — red outline */
#callingModal .btn-outline-secondary {
  background: #fff;
  border: 1px solid #f87171; /* soft red */
  color: #dc2626;            /* strong red text */
  border-radius: 12px;
  height: 44px;
  font-weight: 800;
  min-width: 120px;
  box-shadow: 0 10px 22px rgba(220,38,38,.10);
  transition: all .15s ease;
}

#callingModal .btn-outline-secondary:hover {
  background: #fff5f5;
  border-color: #ef4444;
  color: #b91c1c;
}

#callingModal #cancelCallBtn{
  flex:0 0 auto;
  min-width:140px;
  height:46px;

  background:#fff;
  color:var(--modal-danger);
  border:1px solid #fca5a5;

  border-radius:12px;
  font-weight:900;
  font-size:16px;

  box-shadow:0 10px 22px rgba(220,53,69,.10);
  transition:all .15s ease;
}

#callingModal #cancelCallBtn:hover{
  background:#fff5f5;
  border-color:#fb7185;
  color:var(--modal-danger);
}
