/* ==========================================================================
   Ecommerce Margin Scenario Builder - Design System & Modern Styling
   Colors: Primary Blue (#2563eb), Accent Green (#22c55e), Secondary (#1d4ed8),
   Highlight Amber (#f59e0b), Dark Slate (#0f172a), Neutral Light (#f8fafc)
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --accent-green: #22c55e;
  --accent-green-dark: #16a34a;
  --accent-green-light: #dcfce7;
  --amber: #f59e0b;
  --amber-light: #fef3c7;
  --rose: #ef4444;
  --rose-light: #fee2e2;
  --purple: #8b5cf6;
  --purple-light: #f3e8ff;
  
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(226, 232, 240, 0.8);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 3rem;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ==========================================================================
   Top Tools Switcher Bar (Purple links across apps)
   ========================================================================== */
.top-tools-bar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.35rem 0;
  font-size: 0.82rem;
}

.top-tools-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tools-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tools-links a {
  color: #7c3aed;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.tools-links a:hover, .tools-links a.active {
  color: #5b21b6;
  text-decoration: underline;
}

.top-right-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-right-links a {
  color: #7c3aed;
  font-weight: 600;
  text-decoration: none;
}

.quick-lang-links {
  display: flex;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}

.quick-lang-links span {
  cursor: pointer;
}

.quick-lang-links span:hover, .quick-lang-links span.active {
  color: #2563eb;
  font-weight: 700;
}

/* ==========================================================================
   Dark Brand Header Bar (BizMargin Black Stripe)
   ========================================================================== */
.dark-nav-header {
  background: #0f172a;
  color: white;
  padding: 0.75rem 0;
  border-bottom: 1px solid #1e293b;
}

.dark-nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.brand-icon-sq {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
}

.brand-title-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.03em;
}

.dark-nav-menu {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  flex-wrap: wrap;
}

.dark-nav-menu a {
  color: #cbd5e1;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.dark-nav-menu a:hover {
  color: white;
}

.dark-nav-menu select {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.dark-nav-menu select:focus {
  outline: none;
  border-color: #2563eb;
}

.btn-get-hosting {
  background: #10b981;
  color: white !important;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-weight: 700 !important;
}

.btn-get-hosting:hover {
  background: #059669;
}

/* ==========================================================================
   Trust Strip Banner
   ========================================================================== */
.trust-strip {
  background: #ecfdf5;
  border-bottom: 1px solid #a7f3d0;
  padding: 0.45rem 0;
  font-size: 0.78rem;
  color: #065f46;
  font-weight: 600;
}

.trust-strip-content {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ==========================================================================
   Hero Section & Quick Start Banner
   ========================================================================== */
.hero-header {
  text-align: center;
  margin: 1.75rem 0 1.25rem 0;
}

.hero-header h1 {
  font-size: 2.1rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

.hero-header h1 span {
  color: #10b981;
}

.hero-header p {
  font-size: 0.95rem;
  color: #64748b;
  max-width: 680px;
  margin: 0 auto 1rem auto;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-badge-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
}

.quick-start-banner {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  font-size: 0.85rem;
  color: #166534;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Header Navbar Controls */
.app-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  padding: 0.85rem 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-main) 0%, var(--primary-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.lang-selector, .currency-selector {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: white;
  border: 1px solid var(--card-border);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: 0.82rem;
  font-weight: 600;
}

.lang-selector select, .currency-selector select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
}

/* Pro Badge Pill */
.pro-badge {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
}

/* Mode Switcher Pills */
.mode-switcher-container {
  display: flex;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.mode-pill {
  flex: 1;
  text-align: center;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
}

.mode-pill.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Action Toolbar */
.action-toolbar {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  margin: 1.25rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.platform-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.platform-tab {
  background: #f1f5f9;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.platform-tab:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.platform-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.toolbar-buttons {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent-green);
  color: white;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}
.btn-accent:hover {
  background: var(--accent-green-dark);
  transform: translateY(-1px);
}

.btn-purple {
  background: var(--purple);
  color: white;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}
.btn-purple:hover {
  background: #7c3aed;
  transform: translateY(-1px);
}

.btn-outline {
  background: white;
  border-color: var(--card-border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

/* App Main Layout Grid */
.app-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}

/* Card Containers */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.25rem;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #f1f5f9;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title i {
  color: var(--primary);
}

/* Form Styles */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.tooltip-icon {
  color: var(--text-light);
  font-size: 0.85rem;
  cursor: help;
  position: relative;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix, .input-suffix {
  position: absolute;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}
.input-prefix { left: 0.75rem; }
.input-suffix { right: 0.75rem; }

.form-control {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: white;
  color: var(--text-main);
  transition: var(--transition);
}

.has-prefix { padding-left: 1.85rem; }
.has-suffix { padding-right: 2.2rem; }

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Custom Fee Items */
.custom-fee-item {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.6rem;
  background: #f8fafc;
  padding: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--card-border);
}

.btn-remove-fee {
  background: transparent;
  border: none;
  color: var(--rose);
  cursor: pointer;
  padding: 0.4rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}
.btn-remove-fee:hover { background: var(--rose-light); }

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.kpi-card.accent-green::before { background: var(--accent-green); }
.kpi-card.amber::before { background: var(--amber); }
.kpi-card.purple::before { background: var(--purple); }

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0.2rem 0;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-light);
}

/* Sensitivity Analysis Matrix Cards */
.sensitivity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

@media (max-width: 640px) {
  .sensitivity-grid { grid-template-columns: 1fr; }
}

.sensitivity-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  text-align: center;
}

.sensitivity-card.best { border-top: 3px solid var(--accent-green); }
.sensitivity-card.base { border-top: 3px solid var(--primary); }
.sensitivity-card.worst { border-top: 3px solid var(--rose); }

.sensitivity-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.best .sensitivity-badge { background: var(--accent-green-light); color: var(--accent-green-dark); }
.base .sensitivity-badge { background: var(--primary-light); color: var(--primary-hover); }
.worst .sensitivity-badge { background: var(--rose-light); color: var(--rose); }

/* Pricing Ladder Table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.ladder-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.85rem;
  text-align: left;
}

.ladder-table th {
  background: #f8fafc;
  padding: 0.65rem 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
}

.ladder-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
}

.ladder-table tr.current-price-row {
  background: #eff6ff;
  font-weight: 700;
}

.ladder-table tr.winner-row {
  background: #f0fdf4;
  font-weight: 700;
}

/* Chart Canvas Wrapper */
.chart-container {
  position: relative;
  height: 240px;
  width: 100%;
}

/* Custom Tooltip Styling */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 135%;
  right: -10px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  z-index: 9999;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.3);
  pointer-events: none;
  animation: fadeIn 0.2s ease-in-out;
}

[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: 110%;
  right: 2px;
  border-width: 6px;
  border-style: solid;
  border-color: #0f172a transparent transparent transparent;
  z-index: 9999;
  pointer-events: none;
}

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

/* Drawers & Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 540px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(15px);
  transition: var(--transition);
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--card-border);
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--text-main);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Printable PDF Area override */
@media print {
  body { background: white; color: black; }
  .app-header, .action-toolbar, .btn, .lang-selector, .currency-selector { display: none !important; }
  .app-grid { display: block; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
