/* ============================================================
   Copilot ROI Calculator – Global Styles
   ============================================================ */

:root {
  --primary:       #0969da;
  --primary-dark:  #0550ae;
  --bg-dark:       #0d1117;
  --bg-secondary:  #161b22;
  --bg-card:       #ffffff;
  --green:         #2ea043;
  --green-light:   #3fb950;
  --red:           #f85149;
  --yellow:        #d29922;
  --text-muted:    #8b949e;
  --border:        #30363d;
  --font:          'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --shadow:        0 4px 24px rgba(0,0,0,.12);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.18);
  --radius:        12px;
  --transition:    all .2s ease;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: #e6edf3;
  margin: 0;
  min-height: 100vh;
}

/* ── Login Page ───────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1117 0%, #0d2340 50%, #0d1117 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(9,105,218,.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(46,160,67,.08) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  background: rgba(22,27,34,.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 14px;
}

.login-logo-placeholder {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #e6edf3;
  margin-bottom: .25rem;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: .9rem;
}

.login-card .form-control {
  background: rgba(13,17,23,.8);
  border: 1px solid var(--border);
  color: #e6edf3;
  border-radius: 8px;
  padding: .6rem .9rem;
  transition: var(--transition);
}

.login-card .form-control:focus {
  background: rgba(13,17,23,.95);
  border-color: var(--primary);
  color: #e6edf3;
  box-shadow: 0 0 0 3px rgba(9,105,218,.2);
  outline: none;
}

.login-card .form-label {
  color: #c9d1d9;
  font-size: .875rem;
  font-weight: 500;
}

.btn-login {
  background: var(--primary);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: .7rem;
  border-radius: 8px;
  width: 100%;
  font-size: 1rem;
  transition: var(--transition);
  cursor: pointer;
}

.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ── Dashboard Layout ─────────────────────────────────────── */
.navbar-brand-text {
  font-weight: 700;
  font-size: 1.15rem;
  color: #e6edf3 !important;
}

.navbar-custom {
  background: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
}

.nav-pills-custom {
  gap: .25rem;
}

.nav-pills-custom .nav-link {
  color: var(--text-muted);
  border-radius: 8px;
  padding: .5rem 1rem;
  font-size: .9rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-pills-custom .nav-link:hover {
  color: #e6edf3;
  background: rgba(255,255,255,.06);
}

.nav-pills-custom .nav-link.active {
  color: #fff;
  background: var(--primary);
}

.main-content {
  padding: 1.5rem;
  min-height: calc(100vh - 60px);
}

/* ── Cards ────────────────────────────────────────────────── */
.calc-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  transition: var(--transition);
}

.stat-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }

.stat-card .stat-label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: .25rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-sub {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

.stat-green  { color: var(--green-light); }
.stat-red    { color: var(--red); }
.stat-blue   { color: #58a6ff; }
.stat-yellow { color: #e3b341; }

/* ── Form Inputs ──────────────────────────────────────────── */
.form-control, .form-select {
  background: rgba(13,17,23,.7) !important;
  border: 1px solid var(--border) !important;
  color: #e6edf3 !important;
  border-radius: 8px !important;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(9,105,218,.2) !important;
  background: rgba(13,17,23,.9) !important;
}

.form-control::placeholder { color: var(--text-muted) !important; }

.form-label {
  color: #c9d1d9;
  font-size: .875rem;
  font-weight: 500;
}

/* Spinner buttons */
.qty-group { display: flex; align-items: center; gap: 0; }
.qty-group .form-control {
  text-align: center;
  border-radius: 0 !important;
  border-left: none !important;
  border-right: none !important;
  -moz-appearance: textfield;
}
.qty-group .form-control::-webkit-outer-spin-button,
.qty-group .form-control::-webkit-inner-spin-button { -webkit-appearance: none; }

.qty-btn {
  background: rgba(9,105,218,.15);
  border: 1px solid var(--border);
  color: var(--primary);
  width: 36px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: var(--transition);
  flex-shrink: 0;
}
.qty-btn:first-child { border-radius: 8px 0 0 8px; }
.qty-btn:last-child  { border-radius: 0 8px 8px 0; }
.qty-btn:hover { background: rgba(9,105,218,.3); }

/* Range slider */
.form-range {
  accent-color: var(--primary);
  height: 6px;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--text-muted);
}

/* Plan selector */
.plan-option {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  text-align: left;
  color: #e6edf3;
  width: 100%;
}

.plan-option:hover { border-color: var(--primary); background: rgba(9,105,218,.08); }

.plan-option.selected {
  border-color: var(--primary);
  background: rgba(9,105,218,.15);
}

.plan-option .plan-name { font-weight: 600; font-size: .95rem; }
.plan-option .plan-price { font-size: .8rem; color: var(--text-muted); }
.plan-option .plan-badge {
  font-size: .7rem;
  background: var(--green);
  color: #fff;
  padding: .15rem .4rem;
  border-radius: 4px;
  float: right;
}

/* ── Results Section ──────────────────────────────────────── */
.results-panel {
  display: none;
}

.results-panel.visible {
  animation: fadeInUp .35s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.narrative-box {
  background: linear-gradient(135deg, rgba(9,105,218,.12), rgba(46,160,67,.08));
  border: 1px solid rgba(9,105,218,.3);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: #cdd9e5;
}

.narrative-box strong { color: #79c0ff; }

.breakdown-table td {
  padding: .5rem 0;
  border-bottom: 1px solid rgba(48,54,61,.5);
  color: #c9d1d9;
}
.breakdown-table td:first-child { color: var(--text-muted); font-size: .875rem; }
.breakdown-table td:last-child { font-weight: 600; text-align: right; }
.breakdown-table tr:last-child td { border-bottom: none; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary-custom {
  background: var(--primary);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: .7rem 1.5rem;
  border-radius: 8px;
  transition: var(--transition);
  cursor: pointer;
}
.btn-primary-custom:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-green {
  background: var(--green);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: .6rem 1.25rem;
  border-radius: 8px;
  transition: var(--transition);
  cursor: pointer;
}
.btn-green:hover { background: #238636; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .5rem 1rem;
  border-radius: 8px;
  transition: var(--transition);
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--primary); color: #e6edf3; }

/* ── Tables ───────────────────────────────────────────────── */
.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.custom-table th {
  background: rgba(13,17,23,.8);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.custom-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid rgba(48,54,61,.4);
  color: #c9d1d9;
  vertical-align: middle;
}

.custom-table tbody tr { transition: background .15s; }
.custom-table tbody tr:hover { background: rgba(9,105,218,.06); }
.custom-table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ───────────────────────────────────────────────── */
.badge-admin {
  background: rgba(163,74,247,.2);
  color: #c084fc;
  border: 1px solid rgba(163,74,247,.3);
  border-radius: 20px;
  padding: .2rem .7rem;
  font-size: .75rem;
  font-weight: 600;
}

.badge-sales {
  background: rgba(9,105,218,.2);
  color: #79c0ff;
  border: 1px solid rgba(9,105,218,.3);
  border-radius: 20px;
  padding: .2rem .7rem;
  font-size: .75rem;
  font-weight: 600;
}

.badge-plan {
  background: rgba(46,160,67,.15);
  color: var(--green-light);
  border: 1px solid rgba(46,160,67,.3);
  border-radius: 20px;
  padding: .2rem .6rem;
  font-size: .75rem;
  font-weight: 600;
}

/* ── Settings ─────────────────────────────────────────────── */
.settings-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.settings-section h6 {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Logo Upload ──────────────────────────────────────────── */
.logo-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(13,17,23,.4);
}

.logo-drop-zone:hover,
.logo-drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(9,105,218,.06);
}

.logo-preview {
  max-width: 120px;
  max-height: 80px;
  object-fit: contain;
  border-radius: 8px;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast-msg {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .85rem 1.25rem;
  color: #e6edf3;
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 280px;
  max-width: 380px;
  animation: slideInRight .25s ease;
  transition: opacity .3s, transform .3s;
}

.toast-msg.hide {
  opacity: 0;
  transform: translateX(100%);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-msg.success { border-left: 4px solid var(--green); }
.toast-msg.error   { border-left: 4px solid var(--red); }
.toast-msg.info    { border-left: 4px solid var(--primary); }

/* ── Modal ────────────────────────────────────────────────── */
.modal-content {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: #e6edf3 !important;
}

.modal-header {
  border-bottom: 1px solid var(--border) !important;
}

.modal-footer {
  border-top: 1px solid var(--border) !important;
}

.modal-title { font-weight: 700; color: #e6edf3; }

.btn-close { filter: invert(1) brightness(0.7); }

/* ── Misc ─────────────────────────────────────────────────── */
.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e6edf3;
  margin-bottom: 1.25rem;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; margin: 0; }

.input-group-text {
  background: rgba(9,105,218,.12) !important;
  border: 1px solid var(--border) !important;
  color: #79c0ff !important;
  font-weight: 700;
}

.active-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 4px;
}

.inactive-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  margin-right: 4px;
}

/* ── Chart Containers ─────────────────────────────────────── */
.chart-container { position: relative; }

/* ── Print Styles ─────────────────────────────────────────── */
@media print {
  body {
    background: #fff !important;
    color: #1a1a2e !important;
  }

  .no-print, nav, .navbar-custom, .sidebar, #tab-calculator .calc-card:first-child,
  #saveBtn, #printBtn, #demoBtn {
    display: none !important;
  }

  .results-panel {
    display: block !important;
  }

  .stat-card {
    background: #f8fafc !important;
    border: 1px solid #ddd !important;
    color: #1a1a2e !important;
    break-inside: avoid;
  }

  .stat-card .stat-value { color: #0d2340 !important; }
  .stat-card .stat-label { color: #555 !important; }

  .narrative-box {
    background: #f0f6ff !important;
    border-color: #0969da !important;
    color: #1a1a2e !important;
  }

  .narrative-box strong { color: #0550ae !important; }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 1.5rem;
  }

  .print-header h1 { font-size: 1.5rem; color: #0d1117; }
  .print-header p  { color: #555; }

  .breakdown-table td { color: #1a1a2e !important; border-color: #ddd !important; }
  .breakdown-table td:first-child { color: #555 !important; }

  canvas { max-width: 300px !important; }

  @page { margin: 1.5cm; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-content { padding: 1rem; }
  .stat-card .stat-value { font-size: 1.4rem; }
  .login-card { margin: 1rem; }
}
