/* ==========================================================================
   ZENTHRA STUDIOS · SHADCN / VERCEL MODERN DESIGN SYSTEM
   Ultra-clean, dark-mode focused, mobile-optimized, zero overlapping
   ========================================================================== */

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

:root {
  color-scheme: dark;
  
  /* shadcn/ui zinc dark palette */
  --bg: #09090b;
  --surface: #0f1013;
  --card: #14161b;
  --card-hover: #191c22;
  --card-border: #232730;
  --card-border-subtle: #1c2027;
  
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --primary: #f4f4f5;
  --primary-fg: #09090b;
  --primary-hover: #ffffff;
  
  --secondary: #1e2229;
  --secondary-fg: #f4f4f5;
  --secondary-hover: #262b33;
  
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.15);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.25);
  
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  
  --info: #38bdf8;
  --info-bg: rgba(56, 189, 248, 0.12);
  
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.65);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.25;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

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

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

.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }

/* Focus Ring */
:focus-visible {
  outline: 2px solid rgba(244, 244, 245, 0.6);
  outline-offset: 2px;
}

/* Header & Navigation Bar */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border-subtle);
  width: 100%;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #10b981, #047857);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.brand-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--secondary);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Status Pill (Pulsing live badge) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.775rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: rgba(24, 27, 34, 0.8);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.pill.danger {
  color: #f87171;
  background: var(--danger-bg);
  border-color: var(--danger-border);
}
.pill.danger::before {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

/* Main Container */
main {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 24px 48px;
  flex: 1;
}

/* Hero / Top Section */
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--card-border-subtle);
}

.intro h1 {
  font-size: 1.6rem;
  margin: 4px 0 6px;
}

/* Modern shadcn Toggle Switch */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  background: var(--card);
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle:hover {
  background: var(--card-hover);
  color: var(--text);
  border-color: #383e4a;
}

.toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  background: #27272a;
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  outline: none;
  margin: 0;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.toggle input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.toggle input[type="checkbox"]:checked {
  background: var(--accent);
}

.toggle input[type="checkbox"]:checked::before {
  transform: translateX(16px);
}

/* Notice / Alert Box */
.notice {
  background: var(--secondary);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Metrics Section (shadcn Stats Cards) */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.metric {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric:hover {
  background: var(--card-hover);
  border-color: #383e4a;
  transform: translateY(-1px);
}

.metric span {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric strong {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Navigation Segmented Tabs (shadcn style) */
nav[aria-label="Workspace sections"] {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

nav[aria-label="Workspace sections"]::-webkit-scrollbar {
  display: none;
}

nav button {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

nav button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

nav button.active {
  background: var(--card-hover) !important;
  color: var(--text) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  font-weight: 600;
}

/* Panels / Cards */
.panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.panel h2 {
  margin-bottom: 6px;
}

.panel > p.muted {
  margin-bottom: 18px;
}

/* Buttons */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--secondary);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
}

button:hover {
  background: var(--secondary-hover);
  border-color: #3b4250;
  color: #ffffff;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button.primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  font-weight: 600;
}

button.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #000000;
}

#refresh {
  background: transparent;
  border-color: var(--card-border);
  font-size: 0.8rem;
  padding: 6px 12px;
}

#refresh:hover {
  background: var(--secondary);
}

/* Form Controls */
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input, select, textarea {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: #09090b;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 9px 13px;
  transition: var(--transition);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(244, 244, 245, 0.4);
  background: #0d0e12;
  box-shadow: 0 0 0 1px rgba(244, 244, 245, 0.2);
}

/* Form Layouts */
.inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.inline label {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 16px 0;
}

.wide {
  grid-column: 1 / -1;
}

/* INBOX / CONVERSATIONS SECTION (Modern Vercel Split View) */
.inbox {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

.inbox aside.panel {
  padding: 16px;
  height: calc(100vh - 240px);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.inbox aside label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#search {
  margin-bottom: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 38px;
}

#contacts {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

#contacts::-webkit-scrollbar {
  width: 5px;
}

#contacts::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: var(--radius-full);
}

.contact-row {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: var(--transition);
  cursor: pointer;
}

.contact-row:hover {
  background: var(--secondary);
  border-color: var(--card-border-subtle);
}

.contact-row.selected {
  background: #171b23;
  border-color: #2b3340;
  box-shadow: inset 3px 0 0 var(--accent);
}

.contact-row strong {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text);
}

.contact-row small {
  font-size: 0.775rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Conversation Pane */
#conversation.panel {
  padding: 24px;
  height: calc(100vh - 240px);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  overflow: hidden;
}

#conversation h2 {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.summary {
  background: #09090b;
  border: 1px solid var(--card-border);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

/* Chat Stream History */
.history {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #09090b;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  margin-top: 12px;
}

.history::-webkit-scrollbar {
  width: 6px;
}

.history::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: var(--radius-full);
}

.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
  position: relative;
}

/* User / Customer Bubble */
.bubble.user {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-bottom-left-radius: 2px;
}

/* AI Model / Assistant Bubble */
.bubble.model {
  align-self: flex-end;
  background: #182029;
  border: 1px solid #2a374a;
  color: #f1f5f9;
  border-bottom-right-radius: 2px;
}

/* Human Operator Bubble */
.bubble.human {
  align-self: flex-end;
  background: #142820;
  border: 1px solid #234838;
  color: #e2fced;
  border-bottom-right-radius: 2px;
}

/* Internal Note Bubble */
.bubble.note {
  align-self: center;
  max-width: 95%;
  background: transparent;
  border: 1px dashed var(--card-border);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.bubble small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Empty State */
.empty {
  padding: 48px 16px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.875rem;
}

/* Table Rows / Call List */
.row {
  border-bottom: 1px solid var(--card-border-subtle);
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.row:last-child {
  border-bottom: none;
}

.row strong {
  font-size: 0.95rem;
  color: var(--text);
}

.row p {
  margin: 2px 0;
  font-size: 0.85rem;
}

/* Form Booking Links */
#formLink {
  margin-top: 8px;
}

#formLink a {
  display: inline-block;
  font-size: 0.825rem;
  color: var(--accent);
  word-break: break-all;
  padding: 4px 8px;
  background: var(--accent-glow);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Footer */
footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 24px;
  border-top: 1px solid var(--card-border-subtle);
  margin-top: auto;
}

/* ==========================================================================
   MOBILE & RESPONSIVE OPTIMIZATIONS (ZERO OVERLAPPING GUARANTEED)
   ========================================================================== */

@media (max-width: 1024px) {
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  header {
    padding: 12px 16px;
    gap: 12px;
  }
  
  .brand span {
    display: none;
  }
  
  main {
    padding: 16px 16px 40px;
  }
  
  .intro {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  
  .toggle {
    justify-content: space-between;
    width: 100%;
  }
  
  .inbox {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .inbox aside.panel {
    height: auto;
    min-height: auto;
    max-height: 380px;
  }
  
  #conversation.panel {
    height: auto;
    min-height: 480px;
  }
  
  .history {
    max-height: 380px;
  }
  
  .bubble {
    max-width: 90%;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 13.5px;
  }
  
  header {
    flex-wrap: wrap;
    padding: 10px 14px;
  }
  
  .header-controls {
    width: 100%;
    justify-content: space-between;
    margin-top: 4px;
  }
  
  .metrics {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .metric {
    padding: 14px 16px;
  }
  
  .metric strong {
    font-size: 1.65rem;
  }
  
  .panel {
    padding: 16px;
    border-radius: var(--radius);
  }
  
  .inline {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .inline label {
    min-width: 100%;
  }
  
  .inline button {
    width: 100%;
  }
  
  .actions {
    flex-direction: column;
  }
  
  .actions button {
    width: 100%;
  }
  
  nav[aria-label="Workspace sections"] {
    width: 100%;
    padding: 3px;
  }
  
  nav button {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

/* Booking Page Specifics */
.booking {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 16px;
}

.booking h1 {
  font-size: 2rem;
  margin: 6px 0 12px;
}

@media (max-width: 640px) {
  .booking {
    margin: 20px auto;
    padding: 0 12px;
  }
  .booking h1 {
    font-size: 1.6rem;
  }
}
