/* ===== chim.ai Admin Dashboard — Dark Theme ===== */

:root {
  --bg-black: #05060b;
  --bg-deep: #0a0b10;
  --bg-panel: rgba(14, 18, 30, 0.72);
  --bg-panel-alt: rgba(6, 10, 18, 0.72);
  --blue-accent: #68a3df;
  --pink-accent: #ff93e4;
  --text-bright: #f5f7ff;
  --text-heading: #e6ebff;
  --text-muted: rgba(198, 210, 255, 0.7);
  --text-subtle: rgba(198, 210, 255, 0.5);
  --border-subtle: rgba(198, 210, 255, 0.1);
  --border-hover: rgba(198, 210, 255, 0.2);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow-panel: 0 20px 60px rgba(0, 0, 0, 0.5);
  --gradient: linear-gradient(45deg, #68a3df 30%, #ff93e4 70%);
  --font: "Livvic", sans-serif;
  --header-height: 52px;
}

/* ===== Reset & Base ===== */

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

html, body {
  height: 100%;
  background: var(--bg-black);
  color: var(--text-bright);
  font-family: var(--font);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: rgba(8, 9, 14, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
}

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.header-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.header-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--text-bright);
}

.header-nav .nav-logout {
  color: var(--text-subtle);
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.header-nav .nav-logout:hover {
  color: var(--pink-accent);
}

/* ===== Main Content ===== */

.app-main {
  padding-top: calc(var(--header-height) + 32px);
  padding-bottom: 48px;
  max-width: 1000px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
  min-height: 100vh;
}

/* ===== Glass Panel ===== */

.panel {
  background: linear-gradient(135deg, var(--bg-panel), var(--bg-panel-alt));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  border: 1px solid var(--border-subtle);
  padding: 32px;
  margin-bottom: 24px;
}

.panel-sm {
  padding: 20px 24px;
}

/* ===== Typography ===== */

h1 {
  font-size: 2rem;
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

h1.gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: 16px;
}

h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
}

/* ===== Forms ===== */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-bright);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 300;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.form-input:focus {
  border-color: var(--blue-accent);
  background: rgba(255, 255, 255, 0.09);
}

.form-input::placeholder {
  color: var(--text-subtle);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23c6d2ff' stroke-opacity='0.5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

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

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--text-bright);
  color: var(--bg-black);
}

.btn-primary:hover {
  background: var(--gradient);
  color: var(--bg-black);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-bright);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--border-hover);
}

.btn-danger {
  background: rgba(255, 80, 80, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(255, 80, 80, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 80, 80, 0.25);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ===== Table ===== */

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

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(198, 210, 255, 0.05);
  font-weight: 300;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tr.clickable {
  cursor: pointer;
}

.data-table tr.clickable:hover td {
  background: rgba(104, 163, 223, 0.08);
}

/* ===== Status Badges ===== */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-active {
  background: rgba(80, 200, 120, 0.15);
  color: #50c878;
}

.badge-draft {
  background: rgba(255, 193, 70, 0.15);
  color: #ffc146;
}

.badge-completed {
  background: rgba(104, 163, 223, 0.15);
  color: var(--blue-accent);
}

.badge-archived {
  background: rgba(198, 210, 255, 0.08);
  color: var(--text-subtle);
}

.badge-pending {
  background: rgba(255, 193, 70, 0.12);
  color: #ffc146;
}

.badge-done {
  background: rgba(80, 200, 120, 0.15);
  color: #50c878;
}

.badge-new {
  background: rgba(80, 200, 120, 0.15);
  color: #50c878;
}

.badge-contacted {
  background: rgba(104, 163, 223, 0.15);
  color: #68a3df;
}

.badge-converted {
  background: rgba(255, 147, 228, 0.15);
  color: #ff93e4;
}

.badge-archived {
  background: rgba(198, 210, 255, 0.15);
  color: rgba(198, 210, 255, 0.5);
}

.stage-mini {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  background: rgba(104, 163, 223, 0.15);
  color: #68a3df;
  font-size: 0.85rem;
  font-weight: 500;
}

.code-block {
  background: rgba(6, 10, 18, 0.6);
  border: 1px solid rgba(198, 210, 255, 0.1);
  border-radius: 8px;
  padding: 16px;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  color: rgba(198, 210, 255, 0.7);
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ===== Page Header ===== */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  margin-bottom: 0;
}

/* ===== Breadcrumb ===== */

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--blue-accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  margin: 0 6px;
}

/* ===== Copy Link ===== */

.copy-link {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 8px 14px;
  margin-bottom: 16px;
}

.copy-link code {
  flex: 1;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--blue-accent);
  word-break: break-all;
}

.copy-link .btn {
  white-space: nowrap;
}

/* ===== Stats Row ===== */

.stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  min-width: 120px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--text-heading);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ===== Login ===== */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height) - 80px);
}

.login-panel {
  width: 100%;
  max-width: 380px;
}

.login-panel h1 {
  text-align: center;
}

.login-error {
  background: rgba(255, 80, 80, 0.1);
  border: 1px solid rgba(255, 80, 80, 0.2);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  color: #ff6b6b;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

/* ===== Empty State ===== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-subtle);
}

.empty-state p {
  margin-bottom: 16px;
}

/* ===== Modal / Overlay ===== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin-bottom: 20px;
}

/* ===== Utilities ===== */

.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-sm { font-size: 0.85rem; }
.text-pink { color: var(--pink-accent); }
.text-blue { color: var(--blue-accent); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ===== Responsive ===== */

@media (max-width: 600px) {
  .app-main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .panel {
    padding: 20px;
    border-radius: var(--radius-sm);
  }

  h1 { font-size: 1.5rem; }

  .stats-row {
    flex-direction: column;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
