/* ═══════════════════════════════════════════════════════════════════════════
   MODERN AI CAMPAIGN DASHBOARD - STRIPE/LINEAR INSPIRED
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-app: #f9fafb; /* Very light cool grey */
  --bg-card: #ffffff;
  --bg-input: #f3f4f6;
  --bg-input-hover: #e5e7eb;
  
  --text-primary: #030712;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.1);
  --border-focus: #030712;

  --accent-black: #030712;
  --accent-black-hover: #1f2937;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-xl: 0 20px 40px -4px rgba(0, 0, 0, 0.06);
  --shadow-float: 0 0 0 1px rgba(0,0,0,0.03), 0 8px 24px rgba(0,0,0,0.08);
}

/* ═══ RESET & BASE ═══ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,0.02) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,30%,0.01) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,30%,0.02) 0, transparent 50%);
  background-attachment: fixed;
  padding-bottom: 60px;
}

/* Icons global alignment */
.lucide {
  stroke: currentColor;
  flex-shrink: 0;
}

/* ═══ FLOATING HEADER ═══ */

.header-container {
  padding: 24px;
  display: flex;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 100;
  pointer-events: none; /* Let clicks pass through empty space */
}

.header {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-float);
  border-radius: var(--radius-pill);
  padding: 8px 12px 8px 20px;
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: 1000px;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-black);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.logo-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ═══ NAVIGATION PILLS ═══ */

.nav-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.03);
  padding: 6px;
  border-radius: var(--radius-pill);
  margin-left: auto;
}

.nav-tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  border-radius: var(--radius-pill);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.03);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-weight: 600;
}

.tab-badge {
  background: var(--accent-black);
  color: var(--text-inverse);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  margin-left: 4px;
}

/* ═══ MAIN CONTENT ═══ */

.main {
  max-width: 1048px;
  margin: 0 auto;
  padding: 0 24px;
}

.tab-content {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ═══ CARDS ═══ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 24px 28px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header h2 .icon {
  color: var(--text-muted);
}

.card-body {
  padding: 0 28px 28px;
}

/* ═══ FORMS ═══ */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input, .form-select {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.form-input:hover, .form-select:hover {
  background: var(--bg-input-hover);
}

.form-input:focus, .form-select:focus {
  background: var(--bg-card);
  border-color: var(--border-focus);
  outline: none;
  box-shadow: 0 0 0 4px rgba(3, 7, 18, 0.06);
}

/* ═══ BUTTONS ═══ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-full); /* Pill shaped buttons */
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-primary, .btn-success {
  background: var(--accent-black);
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled), 
.btn-success:hover:not(:disabled) {
  background: var(--accent-black-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-input);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

/* ═══ STATS GRID ═══ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
}

/* ═══ TABLES ═══ */

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 14px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-app);
}

tbody td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--bg-app);
}

/* ═══ BADGES ═══ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--bg-input); color: var(--text-secondary); }
.badge-neutral { background: var(--bg-input); color: var(--text-secondary); }

/* ═══ UPLOAD AREA ═══ */

.file-upload {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s ease;
}

.file-upload:hover {
  border-color: var(--text-primary);
  background: var(--bg-app);
}

.file-upload-icon {
  margin-bottom: 16px;
  color: var(--text-muted);
}

.file-upload-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.file-upload input[type="file"] {
  display: none;
}

/* ═══ PROGRESS & DIALER ═══ */

.calling-indicator {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
}

.calling-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  margin: 0 2px;
  animation: bounce 1.4s infinite ease-in-out both;
}

.calling-dots span:nth-child(1) { animation-delay: -0.32s; }
.calling-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--text-primary);
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}

/* ═══ MODAL ═══ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-xl);
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ═══ TOAST & NOTIFICATIONS ═══ */

.toast-container {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-inverse);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) 3.7s forwards;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
}

.toast-success { background: var(--accent-black); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--text-secondary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(20px) scale(0.95); }
}

/* ═══ DIAL PAD ═══ */

.dialpad {
  max-width: 280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 24px 0;
}

.dial-key {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  user-select: none;
}

.dial-key:hover {
  background: var(--bg-input-hover);
  transform: scale(1.05);
}

.dial-key:active {
  background: var(--border-strong);
  transform: scale(0.95);
}

.dial-number {
  font-size: 28px;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1;
}

.dial-letters {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
  min-height: 12px;
}

.dial-display {
  font-size: 32px;
  font-weight: 400;
  text-align: center;
  letter-spacing: 2px;
  height: 60px;
  width: 100%;
  color: var(--text-primary);
  margin-bottom: 8px;
  background: transparent;
  border: none;
  outline: none;
}
.dial-display::placeholder {
  color: var(--text-muted);
  font-size: 24px;
  font-weight: 300;
}

/* ═══ CHAT BUBBLES ═══ */

.chat-bubble {
  max-width: 80%;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chat-bubble-ivr {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chat-bubble-caller {
  background: var(--accent-black);
  color: var(--text-inverse);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* ═══ RESPONSIVE ═══ */

@media (max-width: 1024px) {
  .header { padding: 12px 16px; gap: 16px; margin: 0 16px; width: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}

.quick-call-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 16px;
  align-items: end;
}

@media (max-width: 768px) {
  .quick-call-row { grid-template-columns: 1fr; }
  
  /* Top Nav to Sticky Bottom Tab Bar */
  .header-container { display: none; }
  
  .nav-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border);
    justify-content: space-around;
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 20px));
    box-shadow: 0 -4px 12px rgba(0,0,0,0.03);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .nav-tab {
    flex-direction: column;
    padding: 4px;
    gap: 4px;
    font-size: 10px;
    flex: 1;
    border-radius: 8px;
    justify-content: center;
  }
  .nav-tab.active {
    background: transparent;
    color: var(--text-primary);
    box-shadow: none;
  }

  /* Main Container Padding */
  .main { padding: 16px; }

  /* Body Padding for bottom bar */
  body { padding-bottom: 90px; }

  .dashboard-grid { grid-template-columns: 1fr; gap: 16px; }

  .card-body { padding: 16px; }

  table th, table td {
    padding: 12px 10px;
    font-size: 13px;
  }

  .table-wrapper {
    border-radius: var(--radius-sm);
    box-shadow: none;
    border: 1px solid var(--border);
  }

  /* Dialpad */
  .dialpad { gap: 12px; }
  .dial-key { height: 60px; font-size: 24px; padding: 0; }
  .dial-number { font-size: 26px; }
  .dial-display { font-size: 32px; }
  .dial-display::placeholder { font-size: 20px; }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .card-header > div { width: 100%; justify-content: flex-start; }

  /* Form Elements */
  input, select, textarea { font-size: 16px !important; }
}
