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

:root {
  /* ClickSmith brand colors (from theclicksmith.com) */
  --bg: #111318;           /* hsl(220,20%,8%) */
  --bg-card: #191d26;      /* hsl(220,18%,12%) */
  --bg-card-hover: #1e2330;
  --bg-input: #1e2330;
  --border: #272d3d;
  --accent: #e89a5c;       /* hsl(25,68%,69%) — ClickSmith orange */
  --accent-hover: #d98540;
  --accent-light: rgba(232, 154, 92, 0.12);
  --primary: #3dc9c4;      /* hsl(178,56%,53%) — ClickSmith teal */
  --primary-hover: #2db5b0;
  --primary-light: rgba(61, 201, 196, 0.12);
  --text: #ede9e0;         /* hsl(40,10%,92%) */
  --text-muted: #8892a8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --blue: #3dc9c4;
  --sidebar-w: 240px;
  --radius: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 1.5rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg-card-hover); border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #0a1212; border-color: var(--primary); font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); color: #0a1212; }
.btn-block { display: flex; justify-content: center; width: 100%; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-lg { padding: 0.6rem 1.5rem; font-size: 1rem; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text); }
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-header-row .card-title { margin-bottom: 0; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-danger { background: rgba(239,68,68,0.15); border: 1px solid var(--danger); color: var(--danger); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group select { cursor: pointer; }
.form-group select option { background: var(--bg-card); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.input-error { border-color: var(--danger) !important; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; padding: 2rem; margin-left: var(--sidebar-w); overflow-x: hidden; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.header-actions { display: flex; gap: 0.5rem; }

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 1.5rem; }
.brand-text { font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.sidebar-logo { max-width: 160px; height: auto; display: block; }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: all 0.15s;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--primary); background: var(--primary-light); border-right: 3px solid var(--primary); }
.nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.user-badge { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #000;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}
.user-name { font-size: 0.85rem; font-weight: 500; }
.user-role { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.logout-link { padding: 0.4rem 0; font-size: 0.8rem; }

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.brand-icon-lg { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.login-brand h1 { font-size: 2rem; color: var(--primary); }
.login-subtitle { color: var(--text-muted); font-size: 0.9rem; }
.login-form { margin-top: 1.5rem; }
.login-form .btn { margin-top: 0.5rem; }
.login-hint { text-align: center; margin-top: 1.5rem; font-size: 0.75rem; color: var(--text-muted); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.stat-warning .stat-value { color: var(--warning); }

/* Dashboard Grid */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Pipeline Bars */
.pipeline-bars { display: flex; flex-direction: column; gap: 0.6rem; }
.pipeline-bar-row { display: flex; align-items: center; gap: 0.75rem; }
.pipeline-bar-label { font-size: 0.75rem; color: var(--text-muted); width: 160px; flex-shrink: 0; text-align: right; }
/* Quote of the Day */
.quote-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(61,201,196,0.06) 100%);
  border: 1px solid rgba(61,201,196,0.2);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
}
.quote-mark {
  font-size: 3rem;
  line-height: 1;
  color: var(--primary);
  opacity: 0.3;
  position: absolute;
  top: 0.25rem;
  left: 1rem;
  font-family: Georgia, serif;
}
.quote-text {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text);
  line-height: 1.6;
  padding-left: 1rem;
}
.quote-author {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 600;
  padding-left: 1rem;
}

.pipeline-bar-track { flex: 1; height: 20px; background: rgba(255,255,255,0.04); border-radius: 4px; overflow: hidden; }
.pipeline-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; min-width: 4px; }
.pipeline-bar-count { font-size: 0.8rem; font-weight: 600; width: 24px; }

/* Activity Feed */
.activity-feed { display: flex; flex-direction: column; gap: 0.75rem; }
.activity-item { display: flex; gap: 0.75rem; align-items: flex-start; }
.activity-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; flex-shrink: 0;
}
.activity-content { font-size: 0.85rem; }
.activity-time { display: block; font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); cursor: pointer; }
.data-table td { padding: 0.6rem 0.75rem; font-size: 0.85rem; border-bottom: 1px solid rgba(255,255,255,0.04); }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.row-total td { font-weight: 600; background: var(--accent-light); border-top: 2px solid var(--accent); }

/* Stage Badge */
.stage-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  background: var(--accent-light);
  color: var(--accent);
  white-space: nowrap;
}

/* Kanban Board */
.kanban-board {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: calc(100vh - 160px);
}
.kanban-column {
  min-width: 220px;
  max-width: 260px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}
.kanban-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.kanban-title { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.kanban-count {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
}
.kanban-cards { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
}
.kanban-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.kanban-card-link { display: block; padding: 0.75rem; color: var(--text); }
.kanban-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.25rem; }
.kanban-card-name { font-weight: 600; font-size: 0.85rem; }
.kanban-card-biz { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.kanban-card-meta { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); }
.kanban-card-actions { display: flex; gap: 0.3rem; padding: 0 0.75rem 0.5rem; }
.urgency-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.urgency-ok { background: var(--success); }
.urgency-warning { background: var(--warning); }
.urgency-danger { background: var(--danger); }

/* Wizard */
.wizard-progress { background: rgba(255,255,255,0.06); border-radius: 4px; height: 6px; margin-bottom: 1rem; overflow: hidden; }
.wizard-progress-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; }
.wizard-steps { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.wizard-step {
  padding: 0.4rem 0.8rem; border-radius: 4px; font-size: 0.8rem;
  background: rgba(255,255,255,0.04); color: var(--text-muted); cursor: default;
}
.wizard-step.active { background: var(--accent); color: #000; font-weight: 600; }
.wizard-step.done { background: var(--accent-light); color: var(--accent); }
.wizard-section { display: none; }
.wizard-section.active { display: block; }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 1.5rem; }

/* Detail Grid */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.info-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.85rem; }
.info-label { color: var(--text-muted); }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.tab {
  padding: 0.6rem 1.25rem; font-size: 0.85rem; background: none; border: none;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Form Data Grid */
.form-data-grid { display: flex; flex-direction: column; gap: 1rem; }
.form-data-item { padding-bottom: 0.75rem; border-bottom: 1px solid rgba(255,255,255,0.04); }
.form-data-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.25rem; }
.form-data-value { font-size: 0.9rem; white-space: pre-wrap; }

/* KPI */
.kpi-form .kpi-entry-grid { margin-bottom: 1rem; }
.kpi-section-label { font-size: 0.8rem; color: var(--accent); text-transform: uppercase; margin: 1rem 0 0.5rem; }
.kpi-entry-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.75rem; }
.kpi-input-group label { font-size: 0.7rem; color: var(--text-muted); display: block; margin-bottom: 0.2rem; }
.kpi-input-group input {
  width: 100%; padding: 0.5rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 0.9rem;
}
.kpi-input-group input:focus { outline: none; border-color: var(--accent); }

.kpi-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; text-align: center;
}
.kpi-card-accent { border-color: var(--accent); }
.kpi-card-value { font-size: 1.5rem; font-weight: 700; }
.kpi-card-accent .kpi-card-value { color: var(--accent); }
.kpi-card-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.2rem; }

.kpi-mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.kpi-mini { text-align: center; padding: 0.5rem; background: rgba(255,255,255,0.02); border-radius: var(--radius); }
.kpi-mini-value { font-size: 1.1rem; font-weight: 700; display: block; }
.kpi-mini-label { font-size: 0.65rem; color: var(--text-muted); }

/* Charts */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.chart-grid .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.section-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

/* Calendar */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-day {
  aspect-ratio: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,0.02); border-radius: 4px;
  font-size: 0.8rem; position: relative;
}
.calendar-day.today { border: 1px solid var(--accent); }
.calendar-day.logged { background: var(--accent-light); }
.calendar-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-top: 2px; }

/* AI Output */
.ai-content {
  background: rgba(255,255,255,0.03);
  padding: 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
}
.video-concepts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.video-concept-card {
  background: rgba(255,255,255,0.03);
  padding: 1rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  position: relative;
}
.vc-number {
  position: absolute; top: -8px; left: -8px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #000;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
}
.vc-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.4rem; }
.vc-desc { font-size: 0.8rem; color: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1rem; }
  .dashboard-grid, .detail-grid, .chart-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban-board { min-height: auto; }
  .kanban-column { min-width: 200px; }
  .page-header { flex-direction: column; gap: 0.75rem; }
  .page-header .btn { width: 100%; text-align: center; }

  .mobile-menu-btn {
    display: flex;
    position: fixed; top: 1rem; left: 1rem; z-index: 200;
    width: 40px; height: 40px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius);
    align-items: center; justify-content: center;
    color: var(--primary); cursor: pointer; font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  }

  /* Push main content down so hamburger doesn't overlap heading */
  .main-content { padding-top: 4rem; }
  .page-header h1 { font-size: 1.4rem; }

  /* Hide table on mobile, show mobile cards instead */
  .table-wrap { display: none; }
  .mobile-cards { display: flex; flex-direction: column; gap: 0.75rem; }

  /* Hide desktop kanban on mobile */
  .kanban-board { display: none; }
  .pipeline-mobile { display: block; }

  /* Mobile pipeline accordion */
  .pipeline-stage-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.5rem;
    background: var(--bg-card);
  }
  .pipeline-stage-header {
    width: 100%; display: flex; justify-content: space-between; align-items: center;
    padding: 0.9rem 1rem; background: none; border: none; color: var(--text);
    font-size: 0.9rem; font-weight: 600; cursor: pointer; font-family: inherit;
  }
  .pipeline-stage-header:hover { background: var(--bg-card-hover); }
  .pipeline-stage-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--success); }
  .urgency-danger { background: var(--danger) !important; }
  .urgency-warning { background: var(--warning) !important; }
  .urgency-ok { background: var(--success) !important; }
  .pipeline-chevron { font-size: 1rem; color: var(--text-muted); transition: transform 0.2s; }
  .pipeline-stage-body { display: block; }
  .pipeline-stage-body.collapsed { display: none; }

  /* KPI form — tighter 2-col grid on mobile */
  .kpi-entry-row { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .kpi-summary-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .kpi-card-value { font-size: 1.25rem; }

  /* Charts stack full width */
  .chart-grid { grid-template-columns: 1fr; }

  .mobile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .mobile-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.3;
  }
  .mobile-card-business {
    font-size: 0.8rem;
    color: var(--text-muted);
  }
  .mobile-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .mobile-card-days {
    font-size: 0.78rem;
    color: var(--text-muted);
  }
}

@media (min-width: 769px) {
  /* Hide mobile cards/pipeline on desktop */
  .mobile-cards { display: none; }
  .pipeline-mobile { display: none; }
}
@media (min-width: 769px) {
  .mobile-menu-btn { display: none; }
}
