/* Queendom Outreach System - Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #D4910A;
  --primary-dark: #B8732E;
  --primary-light: #F5E6C8;
  --success: #4A7C59;
  --danger: #B83A3A;
  --warning: #D4910A;
  --info: #2D7BB8;
  --bg: #F8F6F2;
  --bg-card: #FFFFFF;
  --bg-sidebar: #2D2A26;
  --bg-sidebar-hover: #3D3A36;
  --text: #2D2A26;
  --text-light: #8A7E6E;
  --text-sidebar: #D4C4B0;
  --border: #E5DED2;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

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

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
}

.sidebar-nav { padding: 8px 0; }
.sidebar-nav .nav-group {
  padding: 12px 20px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.4);
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--text-sidebar);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 13px;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: var(--bg-sidebar-hover);
  color: #fff;
  border-left: 3px solid var(--primary);
  padding-left: 17px;
}
.sidebar-nav .nav-icon { width: 18px; text-align: center; font-size: 15px; }
.sidebar-nav .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.main {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
  font-weight: 500;
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}

.content { padding: 24px; flex: 1; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-actions { display: flex; gap: 8px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: #FAFAF7; border-radius: 0 0 var(--radius) var(--radius); }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 13px; color: var(--text-light); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-card .stat-icon {
  float: right;
  width: 40px; height: 40px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  background: #FAFAF7;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #FAFAF7; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-new { background: #E8F4FD; color: #2D7BB8; }
.badge-contacted { background: #FEF3C7; color: #92400E; }
.badge-replied { background: #DBEAFE; color: #1E40AF; }
.badge-sample_sent { background: #FCE7F3; color: #9D174D; }
.badge-negotiating { background: #E0E7FF; color: #3730A3; }
.badge-won { background: #D1FAE5; color: #065F46; }
.badge-lost { background: #FEE2E2; color: #991B1B; }
.badge-dormant { background: #F3F4F6; color: #6B7280; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(212,145,10,0.15); }
textarea.form-control { resize: vertical; min-height: 100px; font-family: inherit; }
select.form-control { background: #fff; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* Filters bar */
.filters {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filters .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text);
  background: #fff;
  font-size: 13px;
}
.pagination a:hover { background: var(--bg); border-color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: var(--text-light); cursor: not-allowed; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: #D1FAE5; color: #065F46; border-color: #6EE7B7; }
.alert-error { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }
.alert-info { background: #DBEAFE; color: #1E40AF; border-color: #93C5FD; }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FAF6F0 0%, #EDE3D3 100%);
}
.login-card {
  width: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 40px;
}
.login-card .logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-card .logo-icon {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: 12px;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 24px;
  font-weight: bold;
}
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-card .subtitle { text-align: center; color: var(--text-light); margin-bottom: 24px; font-size: 14px; }

/* Lead detail */
.lead-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 24px;
  margin-bottom: 16px;
}
.lead-info-item { display: flex; gap: 8px; }
.lead-info-label { color: var(--text-light); min-width: 80px; }
.lead-info-value { font-weight: 500; }

.timeline { border-left: 2px solid var(--border); padding-left: 16px; margin-left: 8px; }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 4px;
  width: 10px; height: 10px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--primary);
}
.timeline-date { font-size: 12px; color: var(--text-light); }
.timeline-subject { font-weight: 600; margin: 2px 0; }
.timeline-status { font-size: 12px; }
.timeline-status.sent { color: var(--success); }
.timeline-status.failed { color: var(--danger); }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .toggle-slider { background-color: var(--primary); }
input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Progress bars */
.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ============== Mobile Bottom Navigation ============== */
.mobile-nav {
  display: none;
}

/* ============== Mobile Responsive ============== */
@media (max-width: 768px) {
  /* Hide sidebar, show bottom nav */
  .sidebar { display: none !important; }
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  }
  .mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--text-light);
    text-decoration: none;
    font-size: 10px;
    gap: 2px;
    transition: color 0.2s;
  }
  .mobile-nav a.active {
    color: var(--primary);
  }
  .mobile-nav .mnav-icon {
    font-size: 20px;
    line-height: 1;
  }
  .mobile-nav .mnav-label {
    font-size: 10px;
    line-height: 1;
  }

  /* Main content adjustments */
  .main { 
    margin-left: 0 !important; 
    padding-bottom: 70px;
  }
  .topbar {
    padding: 10px 12px;
  }
  .topbar-title {
    font-size: 16px;
  }
  .topbar-right {
    display: none;
  }
  .content {
    padding: 12px;
  }
  
  /* Cards and grids */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .lead-info-grid { grid-template-columns: 1fr !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  
  /* Tables scroll horizontally */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table {
    font-size: 13px;
    min-width: 700px;
  }
  
  /* Forms stack vertically */
  .form-row {
    flex-direction: column !important;
  }
  .form-row .form-group {
    min-width: 100% !important;
  }
  
  /* Filters stack */
  .filters form {
    flex-direction: column !important;
  }
  
  /* Stat cards */
  .stat-row {
    flex-direction: column;
  }
  .stat-card {
    width: 100%;
  }
  
  /* Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .page-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .page-actions .btn {
    flex: 1;
    min-width: 80px;
    font-size: 12px;
  }
  
  /* Modal adjustments */
  .modal-content {
    width: 95% !important;
    max-height: 85vh !important;
  }
  
  /* Cards full width */
  .card {
    margin-bottom: 12px;
  }
  .card-body {
    padding: 12px;
  }
  
  /* Contact cards */
  .contact-card {
    width: 100% !important;
  }
  
  /* Hide some columns on mobile */
  .hide-mobile {
    display: none !important;
  }
  
  /* Pagination */
  .pagination a, .pagination span {
    padding: 6px 10px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  .topbar-title { font-size: 14px; }
  .content { padding: 8px; }
  .card-body { padding: 10px; }
  .btn { font-size: 12px; padding: 6px 10px; }
  .btn-sm { font-size: 11px; padding: 4px 8px; }
  table { font-size: 12px; min-width: 600px; }
  .mobile-nav .mnav-label { font-size: 9px; }
  .mobile-nav .mnav-icon { font-size: 18px; }
}

/* Desktop: hide mobile nav */
@media (min-width: 769px) {
  .mobile-nav { display: none !important; }
}
