/* Ringlr Design System — matches landing page tokens */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0f;
  --bg-card: #13131a;
  --bg-accent: #1a1a25;
  --bg-hover: #1e1e2a;
  --text: #e8e8ed;
  --text-dim: #8888a0;
  --text-muted: #555570;
  --accent: #b4ff39;
  --accent-dim: rgba(180, 255, 57, 0.12);
  --accent-hover: rgba(180, 255, 57, 0.18);
  --coral: #ff6b6b;
  --coral-dim: rgba(255, 107, 107, 0.12);
  --blue: #5b9aff;
  --blue-dim: rgba(91, 154, 255, 0.12);
  --orange: #ffb347;
  --orange-dim: rgba(255, 179, 71, 0.12);
  --green: #4ecdc4;
  --green-dim: rgba(78, 205, 196, 0.12);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

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

/* SIDEBAR */
.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.5px;
  color: var(--text);
  padding: 0 1.5rem;
  margin-bottom: 2rem;
}
.sidebar-logo span { color: var(--accent); }

.sidebar-nav {
  list-style: none;
  flex: 1;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav li a:hover {
  color: var(--text);
  background: var(--bg-accent);
}
.sidebar-nav li a.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.sidebar-nav li a .nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-footer a:hover { color: var(--text); }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 2rem;
  min-height: 100vh;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}
.page-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.page-header .subtitle {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* STAT CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}
.stat-card.coral::before { background: linear-gradient(90deg, transparent, var(--coral), transparent); }
.stat-card.blue::before { background: linear-gradient(90deg, transparent, var(--blue), transparent); }
.stat-card.orange::before { background: linear-gradient(90deg, transparent, var(--orange), transparent); }

.stat-card .stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.stat-card .stat-change {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.stat-card .stat-change.up { color: var(--accent); }
.stat-card .stat-change.down { color: var(--coral); }

/* DATA TABLE */
.data-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.table-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
}
.table-filters {
  display: flex;
  gap: 0.5rem;
}
.filter-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.filter-btn.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(180,255,57,0.3); }

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 0.75rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-accent);
}
.data-table td {
  padding: 0.85rem 1.5rem;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}
.data-table tr:hover td {
  background: rgba(255,255,255,0.02);
}
.data-table tr:last-child td {
  border-bottom: none;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.missed { background: var(--coral-dim); color: var(--coral); }
.badge.answered { background: var(--green-dim); color: var(--green); }
.badge.voicemail { background: var(--blue-dim); color: var(--blue); }
.badge.new { background: var(--accent-dim); color: var(--accent); }
.badge.contacted { background: var(--blue-dim); color: var(--blue); }
.badge.qualified { background: var(--orange-dim); color: var(--orange); }
.badge.converted, .badge.booked { background: var(--green-dim); color: var(--green); }
.badge.replied { background: var(--accent-dim); color: var(--accent); }
.badge.pending { background: var(--orange-dim); color: var(--orange); }
.badge.confirmed { background: var(--blue-dim); color: var(--blue); }
.badge.completed { background: var(--green-dim); color: var(--green); }
.badge.cancelled { background: var(--coral-dim); color: var(--coral); }
.badge.urgent { background: var(--coral-dim); color: var(--coral); }
.badge.high { background: var(--orange-dim); color: var(--orange); }
.badge.normal { background: var(--blue-dim); color: var(--blue); }
.badge.low { background: rgba(255,255,255,0.06); color: var(--text-dim); }
.badge.sent { background: var(--green-dim); color: var(--green); }

/* PHONE NUMBER */
.phone-number {
  font-family: 'Space Grotesk', monospace;
  font-size: 0.9rem;
  color: var(--text);
}

/* CALLER INFO */
.caller-info {
  display: flex;
  flex-direction: column;
}
.caller-info .name {
  font-weight: 500;
  color: var(--text);
}
.caller-info .detail {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* TIME AGO */
.time-ago {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-accent);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: #c5ff5a;
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}
.btn-danger {
  border-color: rgba(255,107,107,0.3);
  color: var(--coral);
}
.btn-danger:hover {
  background: var(--coral-dim);
}

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--bg-accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* CARD */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-dim);
}
.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}
.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

/* LIVE INDICATOR */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
  margin-right: 0.5rem;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  min-width: 300px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease;
}
.toast.success { border-left: 3px solid var(--accent); }
.toast.error { border-left: 3px solid var(--coral); }
.toast.info { border-left: 3px solid var(--blue); }
.toast-icon { font-size: 1.2rem; }
.toast-message { font-size: 0.9rem; flex: 1; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* MOBILE MENU TOGGLE */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 60;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  .mobile-menu-btn {
    display: block;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .data-table-wrapper {
    overflow-x: auto;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding-top: 3rem;
  }
}
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-accent);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* SKELETON LOADING */
.skeleton {
  background: linear-gradient(90deg, var(--bg-accent) 25%, var(--bg-hover) 50%, var(--bg-accent) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* CALL ACTIVITY TIMELINE */
.activity-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.activity-icon.call-missed { background: var(--coral-dim); color: var(--coral); }
.activity-icon.call-answered { background: var(--green-dim); color: var(--green); }
.activity-icon.sms-sent { background: var(--blue-dim); color: var(--blue); }
.activity-icon.lead-new { background: var(--accent-dim); color: var(--accent); }
.activity-content { flex: 1; }
.activity-content .activity-title { font-size: 0.9rem; font-weight: 500; }
.activity-content .activity-detail { font-size: 0.8rem; color: var(--text-dim); }
.activity-time { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

/* TOGGLE SWITCH */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-accent);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-dim);
  top: 2px;
  left: 2px;
  transition: all 0.3s;
}
.toggle input:checked + .toggle-slider {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.toggle input:checked + .toggle-slider::before {
  background: var(--accent);
  transform: translateX(20px);
}
