/* ============================================================
   ALEXANDER AI INVENTORY — Design System v3
   Brand: Deep Violet + Electric Cyan
   Font: Inter (Google Fonts)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Brand — Alexander AI: Deep violet + electric blue */
  --brand:        #7c3aed;   /* violet — premium, AI, modern */
  --brand-light:  #a78bfa;
  --brand-dark:   #5b21b6;
  --brand-bg:     #f5f3ff;
  --brand-accent: #06b6d4;   /* electric cyan — energy, tech */

  /* Neutrals */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --success:     #10b981;
  --success-bg:  #d1fae5;
  --success-text:#065f46;
  --warning:     #f59e0b;
  --warning-bg:  #fef3c7;
  --warning-text:#92400e;
  --danger:      #ef4444;
  --danger-bg:   #fee2e2;
  --danger-text: #991b1b;
  --info:        #3b82f6;
  --info-bg:     #dbeafe;
  --info-text:   #1e40af;

  /* UI */
  --nav-height: 60px;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow:     0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-md:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-lg:  0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ── Navigation ─────────────────────────────────────────────── */
header {
  background: var(--gray-900);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  gap: 1rem;
}

.logo {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
}

.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.stats-badge {
  background: rgba(99,102,241,0.15);
  color: var(--brand-light);
  border: 1px solid rgba(99,102,241,0.25);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-user {
  color: var(--gray-400);
  font-size: 0.8rem;
  font-weight: 500;
}

.nav-logout {
  color: var(--gray-400);
  font-size: 0.82rem;
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  transition: var(--transition);
  font-weight: 500;
}

.nav-logout:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
}

/* CTA button in nav */
.nav-cta {
  background: var(--brand);
  color: white !important;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
  border: none;
  letter-spacing: 0.01em;
}

.nav-cta:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.4rem;
  min-width: 36px;
  min-height: 36px;
  justify-content: center;
  align-items: center;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gray-400);
  border-radius: 2px;
  transition: var(--transition);
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Main Content ───────────────────────────────────────────── */
main {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ── Flash Messages ─────────────────────────────────────────── */
.flash-messages { margin-bottom: 1.25rem; }

.flash {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid transparent;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #a7f3d0;
}

.flash-error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #fca5a5;
}

/* ── Dashboard ──────────────────────────────────────────────── */
.dashboard h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  text-align: left;
}

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-box {
  background: white;
  padding: 1.4rem 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
}

.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.stat-label {
  color: var(--gray-500);
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  font-weight: 600;
  min-height: 38px;
  letter-spacing: 0.01em;
  font-family: inherit;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 1px 2px rgba(99,102,241,0.3);
}

.btn-primary:hover {
  background: var(--brand-dark);
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239,68,68,0.35);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}

.btn-small {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  min-height: 32px;
}

.btn-large {
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  min-height: 46px;
}

/* ── Product Cards ──────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.product-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}

.product-image {
  height: 200px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.no-image {
  color: var(--gray-400);
  font-size: 2rem;
}

.product-info {
  padding: 1.25rem;
}

.product-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.sku {
  color: var(--gray-400);
  font-size: 0.78rem;
  font-weight: 500;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.price {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.03em;
  margin: 0.5rem 0;
}

/* ── Status Badges ──────────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-available {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-sold {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.status-reserved {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.status-pending {
  background: var(--info-bg);
  color: var(--info-text);
}

/* ── Product Actions ────────────────────────────────────────── */
.product-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ── Actions Bar ────────────────────────────────────────────── */
.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-container {
  max-width: 600px;
  margin: 0 auto;
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-700);
  letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--gray-800);
  background: white;
  min-height: 42px;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--gray-400);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
  flex-wrap: wrap;
}

/* ── Tables ─────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

th {
  background: var(--gray-50);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--gray-200);
}

td {
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
  background: var(--gray-50);
}

/* ── Cards / Panels ─────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2, .card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}

.card-body { padding: 1.5rem; }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--gray-400);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* ── Product Detail ─────────────────────────────────────────── */
.product-detail {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  color: var(--brand);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.back-link:hover { color: var(--brand-dark); }

.product-header { margin-bottom: 1.5rem; }

.product-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.product-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.image-gallery img {
  max-width: 100%;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  border: 1px solid var(--gray-200);
}

/* ── Image Editor ───────────────────────────────────────────── */
.image-editor .editor-container {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.canvas-wrapper {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: var(--gray-50);
  transition: var(--transition);
}

.canvas-wrapper:hover { border-color: var(--brand); }

#editor-canvas {
  max-width: 100%;
  max-height: 500px;
  border-radius: var(--radius-sm);
}

.editor-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.image-thumbnails {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.image-thumbnails img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-200);
  transition: var(--transition);
}

.image-thumbnails img:hover,
.image-thumbnails img.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}

.image-thumb {
  width: 80px;
  text-align: center;
}

.image-thumb span {
  font-size: 0.72rem;
  color: var(--gray-400);
}

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--gray-400);
  font-size: 0.8rem;
  border-top: 1px solid var(--gray-200);
  margin-top: 4rem;
  background: white;
}

/* ── Alerts / Banners ───────────────────────────────────────── */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: #fde68a;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #a7f3d0;
}

.alert-info {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: #93c5fd;
}

/* ── Section Headings ───────────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
  font-weight: 400;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.03em;
}

/* ── Settings / Modal ───────────────────────────────────────── */
.settings-modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  header { height: auto; min-height: var(--nav-height); }

  nav {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .nav-links {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius);
    padding: 0.4rem 0;
    margin-top: 0.25rem;
  }

  .nav-links.open { display: flex; }

  .nav-links a {
    padding: 0.7rem 1rem;
    border-radius: 0;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }

  .nav-links a:last-child { border-bottom: none; }

  .logo { font-size: 0.85rem; }

  .nav-cta,
  .stats-badge,
  .nav-user { display: none !important; }

  .hamburger { display: flex !important; }

  main { padding: 0 1rem; margin: 1rem auto; }

  .products-grid { grid-template-columns: 1fr; }

  .product-content { grid-template-columns: 1fr; }

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

  .stat-value { font-size: 1.5rem; }

  table { font-size: 0.8rem; }
  th, td { padding: 0.6rem 0.75rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-container { padding: 1.25rem; }
  .btn { font-size: 0.82rem; }
}
