/* ALVEZA SOURCING COMMAND CENTER - FRESH LIGHT EMERALD DESIGN SYSTEM */

:root {
  --bg-main: #F8FAFC;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ECFDF5;
  --accent: #10B981;
  --border-color: #E2E8F0;
  --text-dark: #0F172A;
  --text-muted: #64748B;
  --text-light: #475569;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --radius: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Global Hidden Utility Rule (IMPORTANT) */
.hidden {
  display: none !important;
}

body {
  background-color: var(--bg-main);
  color: var(--text-dark);
  font-size: 0.85rem;
  line-height: 1.5;
  min-height: 100vh;
}

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
  color: white;
}

.brand-logo {
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-tag {
  font-size: 0.72rem;
  opacity: 0.9;
  margin-top: 2px;
}

.sidebar-menu {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-light);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  cursor: pointer;
}

.menu-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.menu-item.active {
  background-color: var(--primary);
  color: white;
}

.menu-item .menu-icon {
  font-size: 1rem;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.72rem;
  color: var(--text-muted);
  background-color: #FAFAFA;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Navbar */
.top-navbar {
  height: 60px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

.nav-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-online {
  background-color: var(--primary-light);
  color: var(--primary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
}

/* Content Container */
.page-container {
  padding: 24px;
  flex: 1;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

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

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-info .stat-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-info .stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-top: 2px;
}

/* Action Toolbar */
.section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #F1F5F9;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #E2E8F0;
}

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

/* Data Tables (Shopee-Style Compact UI Protocol 19) */
.table-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.78rem;
}

th {
  background-color: #F8FAFC;
  color: var(--text-muted);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

tr:hover {
  background-color: #F1F5F9;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 800;
}

.badge-emerald {
  background-color: var(--primary-light);
  color: var(--primary);
}

.badge-amber {
  background-color: var(--warning-light);
  color: var(--warning);
}

/* Forms & Cards */
.card-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.82rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-content {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 14px 20px;
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 0.9rem;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 12px 20px;
  background-color: #F8FAFC;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
}

.toast {
  background-color: #0F172A;
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  margin-top: 8px;
  animation: toastIn 0.25s ease;
}

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

/* Responsive Rules */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .mobile-toggle {
    display: block;
  }
}

/* =========================================================
   SHOPEE-STYLE CATALOG REFACTOR 
   (Information Density, Category Pills, Grid)
   ========================================================= */

/* Category Pills Wrapper */
.category-pills-container {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #E2E8F0;
}
.category-pills-container::-webkit-scrollbar {
  height: 4px;
}
.category-pills-container::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

/* Category Pill Button */
.cat-pill {
  padding: 6px 14px;
  background-color: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.cat-pill:hover {
  background-color: #F1F5F9;
  border-color: #94A3B8;
}
.cat-pill.active {
  background-color: #059669;
  color: #fff;
  border-color: #059669;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

/* Smart Search & Sort Toolbar */
.catalog-smart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.catalog-search-wrapper {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.catalog-search-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
}
.catalog-search-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}
.catalog-search-wrapper input:focus {
  border-color: #059669;
}
.catalog-sort-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.catalog-sort-wrapper select {
  padding: 6px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
  background-color: #fff;
  cursor: pointer;
}

/* Shopee-Style Grid Container */
.catalog-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
/* Compact Item Card */
.catalog-item-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.catalog-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.cat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.cat-item-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1E293B;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.cat-trust-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.cat-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cat-item-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: #059669;
}
.cat-item-sold {
  font-size: 0.7rem;
  color: #64748B;
}
.cat-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed #E2E8F0;
}
.cat-item-location {
  font-size: 0.7rem;
  color: #64748B;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cat-btn-open {
  font-size: 0.7rem;
  color: #2563EB;
  text-decoration: none;
  font-weight: 600;
}
.cat-btn-open:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .catalog-grid-container {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}
