/* === Offer Tool – CSS === */

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --border: #475569;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --green: #22c55e;
  --green-bg: #14532d;
  --red: #ef4444;
  --red-bg: #450a0a;
  --orange: #f97316;
  --orange-bg: #431407;
  --blue: #3b82f6;
  --yellow: #eab308;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Navbar === */
.navbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand a { font-size: 20px; font-weight: 700; color: var(--primary); }
.nav-subtitle { font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.nav-links { display: flex; gap: 8px; flex: 1; }
.nav-links a {
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--bg-input);
  color: var(--text);
  text-decoration: none;
}
.nav-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-muted); }

/* === Container === */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { font-size: 16px; margin-bottom: 16px; color: var(--text); }
.card h3 { font-size: 14px; margin: 12px 0 8px; color: var(--text-muted); }

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-full { width: 100%; text-align: center; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-unsaved { background: var(--orange); animation: pulse-save 1.5s infinite; }
@keyframes pulse-save { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* === Forms === */
input[type="text"], input[type="email"], input[type="password"],
textarea, select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}
label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.form-group { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-inline { display: flex; gap: 8px; align-items: flex-end; }
.form-inline input, .form-inline select { width: auto; flex: 1; }
small.text-muted { display: block; margin-top: 4px; }

/* === Tables === */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; font-size: 14px; }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
.table-striped tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.table-striped tbody tr:hover { background: rgba(255,255,255,0.05); }
.row-blacklisted { opacity: 0.5; }
.row-followup { border-left: 3px solid var(--orange); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.nowrap { white-space: nowrap; }

/* === Badges === */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-red { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange); }
.badge-blue { background: rgba(59,130,246,0.15); color: var(--blue); border: 1px solid var(--blue); }
.badge-gray { background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border); }
.badge-dark { background: #1a1a2e; color: #888; border: 1px solid #444; }

/* === Status Labels === */
.status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-new { background: var(--bg-input); color: var(--text-muted); }
.status-call_attempt { background: rgba(234,179,8,0.15); color: var(--yellow); }
.status-called_no_interest { background: var(--red-bg); color: var(--red); }
.status-called_email_requested { background: rgba(59,130,246,0.15); color: var(--blue); }
.status-email_scheduled { background: rgba(59,130,246,0.15); color: var(--blue); }
.status-email_sent { background: rgba(34,197,94,0.15); color: var(--green); }
.status-followup_due { background: var(--orange-bg); color: var(--orange); }
.status-followup_sent { background: rgba(34,197,94,0.15); color: var(--green); }
.status-appointment { background: rgba(59,130,246,0.2); color: #60a5fa; }
.status-won { background: rgba(34,197,94,0.2); color: #4ade80; }

/* === PageSpeed Score === */
.ps-score { font-weight: 700; font-size: 13px; }
.ps-bad { color: var(--red); }
.ps-mid { color: var(--orange); }

/* === Stats Grid === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-number { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-new .stat-number { color: var(--text-muted); }
.stat-attempt .stat-number { color: var(--yellow); }
.stat-email .stat-number { color: var(--blue); }
.stat-followup .stat-number { color: var(--orange); }
.stat-appointment .stat-number { color: #60a5fa; }
.stat-won .stat-number { color: var(--green); }
.stat-blacklist .stat-number { color: var(--red); }

.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* === Funnel === */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-step { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--bg-input); border-radius: var(--radius); }
.funnel-value { font-weight: 700; }

/* === Filter Bar === */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-input { max-width: 250px; }
.filter-select { max-width: 180px; }
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

/* === Checkbox Group === */
.checkbox-group { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s;
}
.checkbox-label:hover { border-color: var(--primary); }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

.checkbox-group-inline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.checkbox-label-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}
.checkbox-label-sm:hover { border-color: var(--primary); }
.checkbox-label-sm input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--primary); }

/* === Detail Grid === */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h1 { font-size: 22px; }
.header-badges { display: flex; gap: 8px; align-items: center; }

/* === Actions === */
.action-buttons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.action-form { display: flex; flex-direction: column; gap: 4px; }
.action-note { font-size: 12px; padding: 4px 8px; }

/* === Detail View Font Size === */
.detail-grid { font-size: 15px; }
.detail-grid label { font-size: 14px; }
.detail-grid input, .detail-grid textarea, .detail-grid select { font-size: 15px; }
.detail-grid .meta-info { font-size: 14px; }
.action-buttons .btn { font-size: 15px; }
.action-note { font-size: 14px !important; }

/* === Notes === */
.card-notes { border-left: 3px solid var(--yellow); }
.note-form { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 16px; }
.note-form textarea { flex: 1; min-height: 44px; font-size: 15px; }
.note-form .btn { white-space: nowrap; }
.notes-list { display: flex; flex-direction: column; gap: 8px; }
.note-item {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.note-meta { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12px; color: var(--text-muted); }
.note-user { font-weight: 600; }
.note-text { font-size: 15px; line-height: 1.6; white-space: pre-wrap; }

/* === Guide Accordion === */
.card-guide { border-left: 3px solid var(--primary); padding: 0; }
.accordion { }
.accordion-header {
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
}
.accordion-header::-webkit-details-marker { display: none; }
.accordion-header::after { content: '▸'; font-size: 14px; color: var(--text-muted); transition: transform 0.2s; }
details[open] > .accordion-header::after { transform: rotate(90deg); }
.accordion-body { padding: 0 20px 20px; }

.accordion-step { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.step-header {
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.step-header::-webkit-details-marker { display: none; }
.accordion-step[open] { background: rgba(255,255,255,0.02); }
.accordion-step[open] .step-header { border-bottom: 1px solid var(--border); }
.step-body { padding: 12px 14px 14px 52px; }

.guide-steps { display: flex; flex-direction: column; gap: 0; }
.guide-step { display: flex; gap: 12px; }
.guide-step-number {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.guide-step-content { flex: 1; }
.guide-text { background: var(--bg-input); padding: 12px; border-radius: var(--radius); font-size: 15px; line-height: 1.8; }
.guide-objections { display: flex; flex-direction: column; gap: 8px; }
.objection { background: var(--bg-input); padding: 10px; border-radius: var(--radius); }
.objection-q { font-weight: 600; color: var(--orange); font-size: 15px; margin-bottom: 4px; }
.objection-a { font-size: 15px; color: var(--text); line-height: 1.7; }

/* === Email Card === */
.card-email { border-left: 3px solid var(--green); }
.card-email textarea { min-height: 200px; font-family: monospace; font-size: 12px; }

/* === Email Tabs === */
.email-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.email-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.email-tab-content { display: none; }
.email-tab-content.active { display: block; }
.email-preview-container {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 300px;
}
.email-preview-iframe {
  width: 100%;
  min-height: 300px;
  border: none;
  border-radius: var(--radius);
  background: #fff;
}

/* === Timeline === */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  margin-top: 6px;
  flex-shrink: 0;
}
.dot-imported { background: var(--blue); }
.dot-call_attempt { background: var(--yellow); }
.dot-call_no_interest { background: var(--red); }
.dot-call_email_requested { background: var(--green); }
.dot-email_scheduled { background: var(--blue); }
.dot-email_sent { background: var(--green); }
.dot-followup_due { background: var(--orange); }
.dot-followup_sent { background: var(--green); }
.dot-appointment { background: #60a5fa; }
.dot-won { background: #4ade80; }
.dot-note_added { background: var(--text-muted); }
.dot-contact_updated { background: var(--text-muted); }
.dot-blacklisted { background: var(--red); }

.timeline-content { flex: 1; }
.timeline-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.timeline-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.timeline-note { font-size: 14px; margin-top: 4px; color: var(--text-muted); }
.timeline-user { font-size: 12px; color: var(--text-muted); }

/* === Login === */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { width: 100%; max-width: 400px; padding: 24px; }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand h1 { font-size: 36px; color: var(--primary); }
.login-brand p { color: var(--text-muted); }
.login-form { margin-bottom: 16px; }
.login-form label { margin-bottom: 8px; }
.login-form input { margin-bottom: 16px; }
.login-hint { text-align: center; font-size: 13px; color: var(--text-muted); }

/* === Alerts === */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.alert-warning { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange); }
.alert a { color: inherit; text-decoration: underline; margin-left: 8px; }

/* === Pagination === */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }

/* === Meta Info === */
.meta-info { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; }
.meta-info p { margin-bottom: 4px; }

/* === Error Page === */
.error-page { text-align: center; padding: 60px 0; }
.error-page h1 { font-size: 48px; margin-bottom: 16px; }

/* === Responsive === */
@media (max-width: 768px) {
  .navbar { flex-wrap: wrap; gap: 8px; }
  .nav-links { order: 3; width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .dashboard-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-input, .filter-select { max-width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
