/* ============================================================
   Mashoor AI CRM — Complete Modern Theme (Rust-Orange & Slate)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700&display=swap');

:root {
  --ink:        #1A1A1A;
  --ink-soft:   #333333;
  --canvas:     #F4F5F7;
  --surface:    #FFFFFF;
  --line:       #E2E8F0;
  --line-soft:  #F1F5F9;
  --text:       #2D2D2D;
  --text-dim:   #64748B;
  
  /* Logo Rust-Orange Accents */
  --accent:     #D35400; 
  --accent-hover: #A04000;
  --accent-dim: #FAD7C4;
  --accent-soft: #FDF2E9;

  --s-new:       #94A3B8;
  --s-cold:      #38BDF8;
  --s-warm:      #F59E0B;
  --s-hot:       #EF4444;
  --s-converted: #10B981;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 12px -2px rgba(15, 23, 42, .08);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, .1);
  --sidebar-w: 248px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 8px;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; margin-top: 28px; }
h3 { font-size: 1rem; margin-bottom: 12px; }

.lede {
  color: var(--text-dim);
  margin: 0 0 20px;
  font-size: 14.5px;
}
.muted { color: var(--text-dim); }
.hint { font-size: 12.5px; color: var(--text-dim); margin-top: 8px; }

/* ---------- Shell / Sidebar (Desktop) ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #1E1E1E; /* Metallic Dark Slate */
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: #F8FAFC !important;
  padding: 16px 12px 24px;
  letter-spacing: -0.02em;
  text-decoration: none !important;
  text-align: center;
}

.sidenav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.sidenav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #94A3B8;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none !important;
  transition: background .15s, color .15s;
  position: relative;
}
.sidenav a:hover {
  background: rgba(255,255,255,.06);
  color: #F1F5F9;
}
.sidenav a.on {
  background: rgba(211, 84, 0, .18); /* Rust-orange transparent */
  color: #E67E22;
  font-weight: 600;
}
.sidenav a.on::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #D35400; /* Rust-orange solid */
}

.sidefoot {
  margin-top: auto;
  padding: 20px 12px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidefoot .who {
  font-weight: 600;
  font-size: 13.5px;
  color: #F1F5F9;
}
.sidefoot .org {
  font-size: 12px;
  color: #64748B;
  margin: 2px 0 12px;
}
.sidefoot a {
  color: #F87171;
  font-size: 13px;
  display: inline-block;
  margin-top: 4px;
  text-decoration: none !important;
}
.sidefoot a:hover { color: #FCA5A5; }

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 60px;
}
.wrap { max-width: 1100px; margin: 0 auto; }

/* ---------- Pipeline ---------- */
.pipeline {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.pipeline-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.pipeline-total {
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.pipeline-bar {
  display: flex;
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--line-soft);
  gap: 3px;
}
.pipeline-bar span { display: block; min-width: 4px; border-radius: 99px; }
.pipeline-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.pkey {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--line-soft);
  text-decoration: none !important;
  transition: background .15s, color .15s;
}
.pkey:hover, .pkey.on {
  background: var(--accent-dim);
  color: var(--accent-hover);
}
.pkey i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  display: block;
}

/* ---------- Stage chips ---------- */
.stage {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  color: #fff;
  letter-spacing: .02em;
  white-space: nowrap;
  text-transform: lowercase;
}
.stage-new       { background: var(--s-new); }
.stage-cold      { background: var(--s-cold); }
.stage-warm      { background: var(--s-warm); }
.stage-hot       { background: var(--s-hot); }
.stage-converted { background: var(--s-converted); }
.stage-suspended { background: var(--s-hot); }
.stage-active    { background: var(--s-converted); }

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
}

/* ---------- Panels / cards / tables ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-dim);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}
td {
  padding: 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent-soft); }

.person { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #E67E22); /* Orange gradient */
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.person-name { font-weight: 600; color: var(--ink); }
.person-sub { font-size: 13px; color: var(--text-dim); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card.overdue { border-color: #FECACA; background: #FEF2F2; }
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.ai-note {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  white-space: pre-wrap;
  margin-top: 12px;
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.timeline-item:last-child { border-bottom: none; }
.tl-type {
  flex: 0 0 90px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: capitalize;
}
.tl-body { flex: 1; min-width: 0; }
.tl-meta { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--ink-soft);
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14.5px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff !important;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 2px 4px rgba(211, 84, 0, .25);
}
.btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(211, 84, 0, .3);
  transform: translateY(-1px);
}
.btn:active { transform: scale(.98); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-quiet {
  background: transparent;
  color: var(--ink-soft) !important;
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-quiet:hover {
  background: var(--line-soft);
  border-color: var(--text-dim);
  box-shadow: none;
}

form.inline {
  display: inline-block;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  max-width: none;
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* ---------- Notes / alerts ---------- */
.note {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14.5px;
}
.note-ok {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}
.note-error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

/* ---------- Auth (Login Page Glassmorphism) ---------- */
body.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: url('../bg1.jpg') center/cover no-repeat;
  padding: 24px;
  position: relative;
  z-index: 1;
}
body.auth::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: -1;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(30, 30, 30, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.auth-card h1, .auth-card p {
  color: #ffffff; 
}
.auth-card input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 14px 16px;
  border-radius: 8px;
}
.auth-card input::placeholder { color: rgba(255, 255, 255, 0.5); }
.auth-card input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: #D35400;
  box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.3);
}
.auth-card .btn-block {
  background: linear-gradient(90deg, #F39C12, #D35400);
  color: #fff !important;
  border: none;
  padding: 14px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 8px;
  margin-top: 16px;
  box-shadow: 0 4px 15px rgba(211, 84, 0, 0.4);
}
.auth-card .btn-block:hover {
  background: linear-gradient(90deg, #D35400, #A04000);
  box-shadow: 0 6px 20px rgba(211, 84, 0, 0.6);
}
.auth-card .note-error {
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: #FECACA;
  text-align: center;
}

/* ---------- Reports / Extra ---------- */
.stats-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin: 0 0 24px;
}
.stat-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-value {
  display: block;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.stat-label {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}
.report-cols {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.bar-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 14px;
  margin: 12px 0;
  width: 100%;
}
.bar-label {
  flex: 0 0 110px;
  width: 110px;
  max-width: 110px;
  font-size: 13px;
  text-transform: capitalize;
  color: var(--text);
}
.bar-track {
  flex: 1 1 auto;
  height: 10px;
  min-width: 40px;
  background: var(--line-soft);
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  min-width: 3px;
  transition: width .25s ease;
}
.bar-num {
  flex: 0 0 40px;
  width: 40px;
  text-align: right;
  font-size: 13.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.stage-bg-new { background: var(--s-new) !important; }
.stage-bg-warm { background: var(--s-warm) !important; }
.stage-bg-hot { background: var(--s-hot) !important; }
.stage-bg-converted { background: var(--s-converted) !important; }
.stage-bg-cold { background: var(--s-cold) !important; }
.day-bars {
  display: flex !important;
  align-items: flex-end;
  gap: 8px;
  height: 150px;
  padding: 10px 0 0;
  overflow-x: auto;
}
.day-col {
  flex: 1 1 0;
  min-width: 36px;
  max-width: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.day-bar {
  width: 100%;
  max-width: 40px;
  background: linear-gradient(180deg, #E67E22, var(--accent));
  border-radius: 6px 6px 0 0;
  min-height: 4px;
}
.day-label {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.wa-actions textarea { width: 100%; }

/* ---------- Mobile Hidden Slide-out Menu & Responsive Layout ---------- */
@media (min-width: 769px) {
  .mobile-topbar { display: none !important; }
  .close-sidebar { display: none !important; }
}

@media (max-width: 768px) {
  .shell { flex-direction: column; }
  
  /* Top Bar Header */
  .mobile-topbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    background: #1E1E1E; /* Slate background */
    padding: 14px 20px;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  .mobile-topbar img { height: 32px; width: auto; }
  .mobile-topbar span { font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
  .mobile-topbar button {
    background: none; border: none; color: #fff; font-size: 26px; cursor: pointer; padding: 0;
  }

  /* Hidden Sidebar Setup */
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%; /* Screen se bahar chupa diya */
    width: 260px;
    height: 100vh;
    background: #1E1E1E;
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    z-index: 1000; /* Sab se upar */
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }
  
  /* Jab menu khulega (Class added by JS) */
  .sidebar.open { left: 0; }

  /* Close Button Inside Menu */
  .close-sidebar {
    display: block !important;
    align-self: flex-end;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    margin-bottom: 20px;
    line-height: 1;
  }
  
  /* Hide big desktop logo in mobile menu */
  .desktop-brand { display: none !important; }

  /* Vertical Menu Links */
  .sidenav {
    flex-direction: column;
    width: 100%;
    padding: 0;
    gap: 4px;
    order: 2;
  }
  .sidenav a {
    padding: 12px 16px;
    font-size: 14.5px;
    background: transparent;
    border-radius: var(--radius-sm);
    white-space: normal;
  }
  .sidenav a.on::before { display: block; }
  
  /* Sign out / Foot Info */
  .sidefoot {
    order: 3;
    width: 100%;
    text-align: left;
    padding: 24px 0 20px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: auto;
  }
  .sidefoot .org, .sidefoot .who { display: block; }
  .sidefoot a {
    display: inline-block;
    margin-top: 8px;
    background: transparent;
    color: #F87171;
    padding: 0;
    border-radius: 0;
    font-weight: 500;
  }

  .main { padding: 24px 16px 60px; }
  h1 { font-size: 1.5rem; }
  
  .report-cols { grid-template-columns: 1fr !important; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important; }
  
  /* Responsive Table */
  table, thead, tbody, tr, td, th { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--line); padding: 12px 0; }
  tr:last-child { border-bottom: none; }
  td { border: none; padding: 6px 0; }
  td:empty { display: none; }
}


/* ---------- Nav groups (dropdown sections) ---------- */
.nav-group {
  margin-bottom: 4px;
}
.nav-group-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #94A3B8;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
}
.nav-group-btn::after {
  content: '▾';
  font-size: 10px;
  opacity: 0.7;
  transition: transform .2s ease;
}
.nav-group.open .nav-group-btn::after {
  transform: rotate(180deg);
}
.nav-group-btn:hover {
  color: #F1F5F9;
  background: rgba(255,255,255,.04);
}
.nav-group.has-active > .nav-group-btn {
  color: #E67E22;
}
.nav-group-body {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 6px 0;
}
.nav-group.open > .nav-group-body {
  display: flex;
}
.nav-group-body a {
  padding-left: 18px !important;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
}
.brand-text {
  font-size: 1.05rem;
  color: #F8FAFC;
  font-weight: 700;
}
.desktop-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 16px 10px 20px;
  text-decoration: none !important;
}

/* Mobile topbar default hidden on desktop */
.mobile-topbar { display: none; }
.close-sidebar { display: none; }

@media (max-width: 768px) {
  .nav-group-btn {
    font-size: 12px;
    padding: 10px 12px;
  }
  .nav-group-body a {
    padding: 11px 16px 11px 20px !important;
  }
}
