/* ═══════════════════════════════════════════
   InvestGenuine CRM — Mobile-First App CSS
   ═══════════════════════════════════════════ */

:root {
  --primary:    #0f2544;
  --primary-lt: #1a3c6e;
  --accent:     #f97316;
  --accent-dk:  #ea6c0a;
  --success:    #16a34a;
  --danger:     #dc2626;
  --warning:    #d97706;
  --info:       #2563eb;
  --bg:         #f1f5f9;
  --card:       #ffffff;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --muted:      #64748b;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 1px 8px rgba(0,0,0,0.08);
  --shadow-lg:  0 4px 24px rgba(0,0,0,0.12);
  --nav-h:      68px;
  --header-h:   56px;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { cursor: pointer; background: none; border: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { text-decoration: none; }

/* ─── APP CONTAINER ─── */
.ig-app {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Hide WP theme elements on CRM page */
body:has(.ig-app) .site-header,
body:has(.ig-app) .main-navigation,
body:has(.ig-app) .site-footer,
body:has(.ig-app) #wpadminbar { display: none !important; }
body:has(.ig-app) { background: var(--bg) !important; padding: 0 !important; margin: 0 !important; }
body:has(.ig-app) #page { margin: 0 !important; }

/* ─── SCREENS ─── */
.ig-screen { width: 100%; min-height: 100vh; }
.ig-hidden  { display: none !important; }

/* ─── LOGIN ─── */
.ig-login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #1e4080 100%);
  padding: 20px;
}
.ig-login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.ig-login-logo { text-align: center; margin-bottom: 32px; }
.ig-login-icon { font-size: 48px; margin-bottom: 12px; }
.ig-login-logo h1 { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.ig-login-logo p  { color: var(--muted); font-size: 13px; }
.ig-login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}
.ig-login-form { display: flex; flex-direction: column; gap: 14px; }
.ig-login-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
  background: var(--bg);
}
.ig-login-input:focus { border-color: var(--primary); background: #fff; }
.ig-login-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ig-login-btn:active { transform: scale(0.98); }
.ig-login-btn:hover  { background: var(--primary-lt); }

/* ─── MAIN APP ─── */
.ig-main-app { display: flex; flex-direction: column; height: 100vh; max-height: 100vh; }

/* ─── HEADER ─── */
.ig-header {
  height: var(--header-h);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.ig-header-brand { display: flex; align-items: center; gap: 10px; }
.ig-header-icon  { font-size: 22px; }
.ig-header-title { color: #fff; font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }
.ig-header-logout {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ig-header-logout:hover { background: rgba(255,255,255,0.25); }

/* ─── CONTENT ─── */
.ig-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 0;
  padding-bottom: calc(var(--nav-h) + 8px);
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}

/* ─── BOTTOM NAV ─── */
.ig-bottom-nav {
  height: var(--nav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 100;
}
.ig-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: 12px;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
  flex: 1;
  max-width: 80px;
}
.ig-nav-btn span { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; }
.ig-nav-btn:active { transform: scale(0.93); }
.ig-nav-btn.ig-nav-active { color: var(--primary); }
.ig-nav-btn.ig-nav-active svg { stroke: var(--primary); }
.ig-nav-add {
  background: var(--primary);
  color: #fff !important;
  border-radius: 16px;
  padding: 8px 14px;
}
.ig-nav-add svg { stroke: #fff !important; }
.ig-nav-add.ig-nav-active { background: var(--accent); }

/* ─── CARDS ─── */
.ig-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.ig-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── STAT GRID ─── */
.ig-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.ig-stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 12px;
  text-align: center;
  border-top: 3px solid var(--primary);
  transition: transform 0.15s;
}
.ig-stat-card:active { transform: scale(0.97); }
.ig-stat-num   { font-size: 32px; font-weight: 800; color: var(--primary); line-height: 1; }
.ig-stat-label { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ─── LEAD CARDS ─── */
.ig-lead-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  border-left: 4px solid var(--border);
  transition: box-shadow 0.15s, transform 0.1s;
  cursor: pointer;
}
.ig-lead-card:active { transform: scale(0.99); box-shadow: var(--shadow-lg); }
.ig-lead-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.ig-lead-name  { font-size: 15px; font-weight: 700; color: var(--text); }
.ig-lead-meta  { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.ig-lead-meta-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ig-lead-meta-row svg { flex-shrink: 0; }
.ig-lead-caller { font-size: 11px; font-weight: 700; color: var(--primary-lt); background: #e8eef8; padding: 2px 8px; border-radius: 20px; }
.ig-lead-followup { font-size: 12px; font-weight: 600; }
.ig-lead-followup.overdue  { color: var(--danger); }
.ig-lead-followup.today    { color: var(--warning); }
.ig-lead-followup.upcoming { color: var(--success); }

/* ─── BADGES ─── */
.ig-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* ─── SEARCH & FILTERS ─── */
.ig-search-bar {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ig-search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  transition: border-color 0.15s;
}
.ig-search-input:focus { border-color: var(--primary); background-color: #fff; }
.ig-filter-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.ig-filter-chips::-webkit-scrollbar { display: none; }
.ig-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--muted);
  background: var(--bg);
  transition: all 0.15s;
  white-space: nowrap;
}
.ig-chip.active { border-color: var(--primary); background: var(--primary); color: #fff; }

/* ─── FORMS ─── */
.ig-form { display: flex; flex-direction: column; gap: 14px; }
.ig-field { display: flex; flex-direction: column; gap: 5px; }
.ig-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ig-label .req { color: var(--danger); }
.ig-input, .ig-select, .ig-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.ig-input:focus, .ig-select:focus, .ig-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,37,68,0.08);
}
.ig-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.ig-textarea { resize: none; min-height: 80px; }
.ig-hint { font-size: 11px; color: var(--muted); }

/* ─── BUTTONS ─── */
.ig-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s;
  white-space: nowrap;
}
.ig-btn:active { transform: scale(0.97); }
.ig-btn-primary  { background: var(--primary);  color: #fff; }
.ig-btn-primary:hover  { background: var(--primary-lt); }
.ig-btn-accent   { background: var(--accent);   color: #fff; }
.ig-btn-accent:hover   { background: var(--accent-dk); }
.ig-btn-danger   { background: var(--danger);   color: #fff; }
.ig-btn-success  { background: var(--success);  color: #fff; }
.ig-btn-ghost    { background: var(--bg);        color: var(--text); }
.ig-btn-ghost:hover    { background: var(--border); }
.ig-btn-full     { width: 100%; }
.ig-btn-sm       { padding: 7px 14px; font-size: 12px; }
.ig-btn-lg       { padding: 15px 24px; font-size: 15px; border-radius: 12px; }
.ig-btn-row      { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── NOTES SECTION ─── */
.ig-notes-list   { display: flex; flex-direction: column; gap: 10px; }
.ig-note-item    { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.ig-note-header  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ig-note-num     { font-size: 11px; font-weight: 800; color: var(--primary); text-transform: uppercase; }
.ig-note-meta    { font-size: 11px; color: var(--muted); }
.ig-note-text    { font-size: 13px; color: var(--text); line-height: 1.55; }
.ig-add-note-box { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 12px; background: #fafafa; }
.ig-add-note-box textarea { border: none; background: transparent; padding: 6px 0; width: 100%; font-size: 14px; color: var(--text); outline: none; resize: none; min-height: 70px; }

/* ─── DETAIL PAGE ─── */
.ig-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.ig-back-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ig-detail-name { font-size: 18px; font-weight: 800; color: var(--text); }

/* ─── FOLLOW-UP TABS ─── */
.ig-tabs-row  { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ig-tabs-row::-webkit-scrollbar { display: none; }
.ig-tab-btn   { flex-shrink: 0; padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; background: var(--card); color: var(--muted); border: 1.5px solid var(--border); transition: all 0.15s; }
.ig-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.ig-tab-btn.tab-danger.active  { background: var(--danger);  border-color: var(--danger); }
.ig-tab-btn.tab-warning.active { background: var(--warning); border-color: var(--warning); }

/* ─── BREAKDOWN BARS ─── */
.ig-breakdown    { display: flex; flex-direction: column; gap: 9px; }
.ig-brow         { display: flex; align-items: center; gap: 8px; }
.ig-brow-label   { font-size: 11px; color: var(--text); width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-brow-bar     { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.ig-brow-fill    { height: 100%; border-radius: 5px; min-width: 2px; transition: width 0.5s ease; }
.ig-brow-count   { font-size: 12px; font-weight: 700; color: var(--primary); width: 22px; text-align: right; }

/* ─── SECTION HEADERS ─── */
.ig-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.ig-section-title { font-size: 15px; font-weight: 700; color: var(--primary); }
.ig-count-badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}
.ig-count-badge.danger  { background: var(--danger); }
.ig-count-badge.warning { background: var(--warning); }

/* ─── EMPTY STATES ─── */
.ig-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}
.ig-empty-icon { font-size: 40px; margin-bottom: 10px; }

/* ─── LOADING ─── */
.ig-loading-full {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
}
.ig-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ig-spin 0.7s linear infinite;
}
.ig-spinner-lg {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ig-spin 0.7s linear infinite;
}
@keyframes ig-spin { to { transform: rotate(360deg); } }

/* ─── TOAST ─── */
.ig-toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s;
  max-width: 90vw;
  white-space: normal;
  text-align: center;
}
.ig-toast.success { background: var(--success); }
.ig-toast.danger  { background: var(--danger); }
.ig-toast.warning { background: var(--warning); }

/* ─── INFO ROWS ─── */
.ig-info-row { display: flex; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--bg); font-size: 13px; align-items: flex-start; }
.ig-info-row:last-child { border-bottom: none; }
.ig-info-label { color: var(--muted); min-width: 110px; flex-shrink: 0; font-size: 12px; }
.ig-info-value { color: var(--text); font-weight: 600; word-break: break-word; }

/* ─── CALL BUTTON ─── */
.ig-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #dcfce7;
  color: var(--success);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.ig-call-btn:hover { background: #bbf7d0; }

/* ─── PAGE TRANSITIONS ─── */
.ig-page-enter { animation: ig-fade-in 0.2s ease; }
@keyframes ig-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ─── DESKTOP (≥ 768px) ─── */
@media (min-width: 768px) {
  .ig-content { padding: 20px 20px 0; padding-bottom: calc(var(--nav-h) + 10px); max-width: 768px; margin: 0 auto; width: 100%; }
  .ig-stat-grid { grid-template-columns: repeat(3, 1fr); }
  .ig-form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .ig-form-2col .ig-field-full { grid-column: 1 / -1; }
}

@media (min-width: 1024px) {
  .ig-stat-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ─── ADMIN CSS ─── */
.ig-admin-wrap { max-width: 900px; }
