/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg: #0a0a1a;
  --bg-card: #16213e;
  --bg-input: #1a1a3e;
  --border: #2a2a4a;
  --text: #e0e0e0;
  --text-muted: #999;
  --accent: #06b6d4;
  --accent-hover: #22d3ee;
  --success: #22c55e;
  --warning: #facc15;
  --danger: #ef4444;
  --radius: 8px;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html { scroll-behavior: smooth; }

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

/* Skip to main content (accessibility) */
.skip-to-main {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: #000;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s;
}
.skip-to-main:focus {
  top: 16px;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* Typography hierarchy */
h1 { font-size: 48px; font-weight: 700; line-height: 1.2; }
h2 { font-size: 36px; font-weight: 700; line-height: 1.25; }
h3 { font-size: 28px; font-weight: 600; line-height: 1.3; }
h4 { font-size: 22px; font-weight: 600; line-height: 1.35; }
h5 { font-size: 18px; font-weight: 600; line-height: 1.4; }
h6 { font-size: 16px; font-weight: 600; line-height: 1.4; }

code, pre, .code {
  font-family: var(--font-mono);
}

pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.5;
}

code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}

.header .logo span { color: var(--text); }

.header nav { display: flex; gap: 16px; align-items: center; }
.header nav a { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.header nav a:hover { color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0891b2);
  color: #000;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(6, 182, 212, 0.05);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}
.btn-danger:active { transform: translateY(0); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading button with spinner */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-right-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-primary.btn-loading::after { border-top-color: #000; border-right-color: #000; }
.btn-secondary.btn-loading::after { border-top-color: var(--text); border-right-color: var(--text); }
.btn-danger.btn-loading::after { border-top-color: #fff; border-right-color: #fff; }

/* Focus visible for accessibility */
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text-muted);
}
.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input::placeholder,
.form-group select::placeholder,
.form-group textarea::placeholder {
  color: #555;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.3);
}

.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.3);
}

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

/* Select dropdown styling */
.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Input validation states */
.input-error,
.form-group input.input-error,
.form-group select.input-error,
.form-group textarea.input-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.input-success,
.form-group input.input-success,
.form-group select.input-success,
.form-group textarea.input-success {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.form-error-msg {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
}

.form-success-msg {
  color: var(--success);
  font-size: 12px;
  margin-top: 4px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
}

.card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  border-color: rgba(6, 182, 212, 0.2);
  transform: translateY(-2px);
}

.card-header {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 0;
}

.card-footer {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-card .value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-card .label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}
td { font-size: 14px; }

/* Striped rows */
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }

/* Hover effect */
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(6, 182, 212, 0.05); }

/* Landing page */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

@media (max-width: 640px) {
  .hero { padding: 64px 20px 40px !important; }
  .hero h1 { font-size: 36px !important; }
  .hero p { font-size: 16px !important; }
}

.hero p { font-size: 18px; color: var(--text-muted); max-width: 600px; margin: 0 auto; }

.hero .cta { margin-top: 32px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 24px;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  position: relative;
}

.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.15);
}

.pricing-card .badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #000;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.pricing-card h3 { font-size: 20px; margin-bottom: 8px; }
.pricing-card .price { font-size: 36px; font-weight: 700; color: var(--accent); margin: 16px 0; }
.pricing-card .price span { font-size: 16px; color: var(--text-muted); }
.pricing-card ul { list-style: none; text-align: left; margin: 20px 0; }
.pricing-card ul li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.pricing-card ul li::before { content: '✓ '; color: var(--success); font-weight: bold; }

/* Features */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.feature-card h4 { color: var(--accent); margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-muted); }

/* Homepage four-pillar hub cards */
.hub-card {
  display: block;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}
.hub-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Sell-on-AuditX 2-column layout collapses on mobile */
@media (max-width: 720px) {
  .sell-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
}

/* Scan results */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 700;
  border: 3px solid;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; }
.align-center { align-items: center; }

/* Iris Chat Widget */
.iris-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
  z-index: 1000;
  transition: transform 0.2s;
}
.iris-fab:hover { transform: scale(1.1); }

.iris-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 360px;
  max-height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: none;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.iris-panel.open { display: flex; }

.iris-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.iris-header .dot { width: 10px; height: 10px; background: var(--success); border-radius: 50%; }
.iris-header strong { color: var(--accent); }

.iris-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  max-height: 340px;
}

.iris-msg {
  margin-bottom: 12px;
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.iris-msg.user { background: var(--accent); color: #000; margin-left: auto; border-bottom-right-radius: 4px; }
.iris-msg.assistant { background: var(--bg-input); color: var(--text); border-bottom-left-radius: 4px; }
.iris-msg.assistant.typing { animation: irisPulse 1.2s ease-in-out infinite; }
@keyframes irisPulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

.iris-input {
  display: flex;
  padding: 12px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

.iris-input input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.iris-input input:focus { outline: none; border-color: var(--accent); }
.iris-input button { background: var(--accent); border: none; color: #000; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 16px; }

/* ========================================
   Loading & Animation
   ======================================== */

/* Spinner */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton loading placeholder */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, rgba(255,255,255,0.08) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
  min-height: 20px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Fade in */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

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

/* ========================================
   Toast / Notification Styles
   ======================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  animation: toastSlideIn 0.3s ease-out, toastFadeOut 0.3s ease-in 4.7s forwards;
  max-width: 360px;
}

.toast-success {
  border-color: var(--success);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), var(--bg-card));
}

.toast-error {
  border-color: var(--danger);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), var(--bg-card));
}

.toast-info {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), var(--bg-card));
}

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

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

/* ========================================
   Utility Classes
   ======================================== */

/* Spacing - margin top */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }

/* Spacing - margin bottom */
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mb-48 { margin-bottom: 48px; }

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Flexbox */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }

/* Gaps */
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

/* Visibility */
.hidden { display: none !important; }
.visible { visibility: visible; }

/* Width */
.w-full { width: 100%; }
.max-w-sm { max-width: 480px; }
.max-w-md { max-width: 768px; }
.max-w-lg { max-width: 1024px; }
.max-w-xl { max-width: 1200px; }

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

/* Large desktops (1200px+) */
@media (min-width: 1200px) {
  .pricing-grid { grid-template-columns: repeat(3, 1fr); }
  .features-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Small desktops / large tablets */
@media (max-width: 1024px) {
  h1 { font-size: 40px; }
  .hero { padding: 60px 24px 48px; }
  .container { padding: 20px; }
}

/* Tablets */
@media (max-width: 768px) {
  h1 { font-size: 32px; }
  h2 { font-size: 28px; }
  h3 { font-size: 22px; }

  .hero h1 { font-size: 36px; }
  .hero p { font-size: 16px; }
  .hero { padding: 48px 20px 40px; }

  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 16px;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 16px 40px;
  }

  .header { padding: 12px 16px; }
  .header nav { gap: 10px; flex-wrap: wrap; }
  .header nav a { font-size: 13px; }

  .container { padding: 16px; }
  .page-title { font-size: 22px; }

  th, td { padding: 10px 12px; }

  .iris-panel { width: calc(100% - 48px); right: 24px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Small phones */
@media (max-width: 480px) {
  h1 { font-size: 26px; }
  h2 { font-size: 22px; }
  h3 { font-size: 18px; }

  .hero h1 { font-size: 28px; }
  .hero p { font-size: 15px; }
  .hero { padding: 36px 16px 32px; }
  .hero .cta { flex-direction: column; align-items: center; }
  .hero .cta .btn { width: 100%; }

  .pricing-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }

  .header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .header nav {
    width: 100%;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .container { padding: 12px; }
  .page-title { font-size: 20px; margin-bottom: 16px; }

  .card { padding: 16px; }
  .pricing-card { padding: 24px; }
  .feature-card { padding: 16px; }

  .stat-card .value { font-size: 22px; }
  .stats-grid { grid-template-columns: 1fr; }

  th, td { padding: 8px 10px; font-size: 13px; }

  .btn { padding: 8px 16px; font-size: 13px; }
  .btn-lg { padding: 12px 24px; font-size: 15px; }

  .iris-panel { width: calc(100% - 32px); right: 16px; bottom: 80px; }
  .iris-fab { width: 48px; height: 48px; font-size: 20px; bottom: 16px; right: 16px; }

  .toast { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
