/* ── AutoMedia B2B — Multi-Shop Design System ─────────────────── */
:root {
  --primary: #1a56db;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --dark: #111827;
  --gray-900: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --white: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--gray-100); color: var(--gray-900); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
  background: var(--dark); color: var(--white); padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 60px; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-md);
}
.navbar .logo { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; color: var(--white); }
.navbar .logo span { color: var(--accent); }
.navbar .shop-badge { background: var(--primary); padding: .25rem .75rem; border-radius: 20px; font-size: .8rem; margin-left: .75rem; }
.navbar nav { display: flex; align-items: center; gap: 1.5rem; }
.navbar nav a { color: var(--gray-300); font-size: .9rem; transition: color .2s; }
.navbar nav a:hover, .navbar nav a.active { color: var(--white); text-decoration: none; }
.navbar .user-area { display: flex; align-items: center; gap: 1rem; }
.navbar .user-name { font-size: .85rem; color: var(--gray-400); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.25rem; border: none; border-radius: var(--radius); font-size: .9rem; font-weight: 500; cursor: pointer; transition: all .2s; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: var(--dark); }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-100); text-decoration: none; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Cards & Containers ──────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-200); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 1.5rem; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: .4rem; font-weight: 500; font-size: .9rem; color: var(--gray-700); }
.form-control { width: 100%; padding: .65rem .85rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: .9rem; transition: border-color .2s, box-shadow .2s; outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.15); }
select.form-control { appearance: none; background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center; padding-right: 2.5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--dark) 0%, var(--gray-900) 100%); padding: 2rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .card-body { padding: 2rem; }
.auth-card .auth-title { text-align: center; margin-bottom: 1.5rem; }
.auth-card .auth-title h2 { font-size: 1.5rem; color: var(--dark); }
.auth-card .auth-title p { color: var(--gray-500); font-size: .9rem; margin-top: .25rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .9rem; color: var(--gray-500); }

/* ── Shop selector (landing) ─────────────────────────────────── */
.hero { text-align: center; padding: 4rem 2rem 2rem; }
.hero h1 { font-size: 2.5rem; color: var(--dark); margin-bottom: .5rem; }
.hero p { font-size: 1.1rem; color: var(--gray-600); max-width: 600px; margin: 0 auto; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.shop-card { cursor: pointer; transition: transform .2s, box-shadow .2s; }
.shop-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.shop-card .card-body { padding: 1.5rem; }
.shop-card h3 { font-size: 1.2rem; margin-bottom: .5rem; }
.shop-card p { color: var(--gray-600); font-size: .9rem; }
.shop-card .shop-meta { display: flex; gap: 1rem; margin-top: 1rem; font-size: .8rem; color: var(--gray-500); }

/* ── Catalog ─────────────────────────────────────────────────── */
.catalog-layout { display: grid; grid-template-columns: 260px 1fr; gap: 2rem; }
.filter-panel { position: sticky; top: 80px; height: fit-content; }
.filter-panel .card-body { max-height: calc(100vh - 120px); overflow-y: auto; }
.filter-section { margin-bottom: 1.25rem; }
.filter-section h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); margin-bottom: .5rem; }
.parts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.part-card { transition: box-shadow .2s; }
.part-card:hover { box-shadow: var(--shadow-md); }
.part-card .card-body { padding: 1.25rem; }
.part-card .part-number { font-size: .75rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }
.part-card h4 { font-size: 1rem; margin: .35rem 0; }
.part-card .part-meta { font-size: .85rem; color: var(--gray-600); margin-bottom: .75rem; }
.part-card .part-bottom { display: flex; align-items: center; justify-content: space-between; }
.part-card .price { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.part-card .stock { font-size: .8rem; padding: .2rem .6rem; border-radius: 12px; }
.stock-in { background: #d1fae5; color: #065f46; }
.stock-low { background: #fef3c7; color: #92400e; }
.stock-out { background: #fee2e2; color: #991b1b; }

.add-to-cart { display: flex; gap: .5rem; align-items: center; margin-top: .75rem; }
.qty-input { width: 60px; text-align: center; padding: .4rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: .9rem; }

/* ── Cart sidebar ────────────────────────────────────────────── */
.cart-badge { background: var(--danger); color: var(--white); border-radius: 50%; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; position: relative; top: -8px; left: -6px; }
.cart-sidebar { position: fixed; right: -400px; top: 0; width: 400px; height: 100vh; background: var(--white); box-shadow: -4px 0 15px rgba(0,0,0,.1); z-index: 200; transition: right .3s; display: flex; flex-direction: column; }
.cart-sidebar.open { right: 0; }
.cart-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 199; }
.cart-overlay.open { display: block; }
.cart-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.cart-items { flex: 1; overflow-y: auto; padding: 1rem 1.5rem; }
.cart-item { display: flex; justify-content: space-between; align-items: start; padding: .75rem 0; border-bottom: 1px solid var(--gray-200); }
.cart-item .item-info h5 { font-size: .9rem; }
.cart-item .item-info p { font-size: .8rem; color: var(--gray-500); }
.cart-item .item-right { text-align: right; }
.cart-item .remove-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: .8rem; }
.cart-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); }
.cart-total { display: flex; justify-content: space-between; font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: .75rem 1rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); background: var(--gray-100); border-bottom: 2px solid var(--gray-200); }
td { padding: .75rem 1rem; border-bottom: 1px solid var(--gray-200); font-size: .9rem; }
tr:hover { background: var(--gray-100); }

/* ── Status badges ───────────────────────────────────────────── */
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 12px; font-size: .75rem; font-weight: 600; text-transform: capitalize; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved, .badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-rejected, .badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-ready { background: #dbeafe; color: #1e40af; }
.badge-picked_up { background: #e5e7eb; color: #374151; }

/* ── Stats grid ──────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { text-align: center; padding: 1.5rem 1rem; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: .85rem; color: var(--gray-500); margin-top: .25rem; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 1.5rem; }
.tab { padding: .75rem 1.25rem; font-size: .9rem; font-weight: 500; color: var(--gray-500); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; background: none; border-top: none; border-left: none; border-right: none; }
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; display: flex; align-items: center; gap: .5rem; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem; color: var(--gray-500); }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-500); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: .75rem; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: .5rem; margin-top: 2rem; }
.page-btn { padding: .5rem .85rem; border: 1px solid var(--gray-300); border-radius: var(--radius); background: var(--white); cursor: pointer; font-size: .9rem; }
.page-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .filter-panel { position: static; }
  .form-row { grid-template-columns: 1fr; }
  .navbar { padding: 0 1rem; }
  .navbar nav { gap: .75rem; }
  .hero h1 { font-size: 1.8rem; }
  .shop-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .cart-sidebar { width: 100%; right: -100%; }
}

/* ── Utility ─────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none; }
.w-full { width: 100%; }
