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

:root {
  /* Clean SaaS Theme */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-hover: #f1f5f9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  
  --success: #10b981;
  --success-bg: #d1fae5;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-drawer: -8px 0 30px rgba(0,0,0,0.1);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background-color: var(--bg-main); color: var(--text-main); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { text-decoration: none; color: inherit; }

/* Header & Navbar Adaptation */
.top-red-bar {
  position: sticky;
  top: 0;
  z-index: 41;
}
.main-header {
  position: sticky;
  top: 29px; /* Top Bar height */
  z-index: 40;
}
.category-nav {
  position: sticky;
  top: 104px; /* Top Bar (29px) + Main Header (~75px) */
  z-index: 39;
}
.category-nav a {
  transition: var(--transition);
}
.category-nav a:hover {
  color: #e11d48 !important;
  transform: translateY(-1px);
}
.nav-links { display: flex; gap: 1.25rem; align-items: center; }
.nav-links a { color: #334155; font-weight: 600; font-size: 0.9rem; transition: var(--transition); cursor: pointer; display: flex; align-items: center; gap: 0.3rem;}
.nav-links a:hover { color: #e11d48; }
.cart-trigger { display: flex; align-items: center; gap: 0.4rem; color: #e11d48 !important; font-weight: 700 !important; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.5rem 1rem; border-radius: var(--radius-md); font-weight: 500; font-size: 0.9rem;
  cursor: pointer; transition: var(--transition); border: 1px solid transparent; font-family: inherit;
  gap: 0.5rem;
}
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: var(--bg-surface); color: var(--text-main); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--bg-hover); color: var(--text-main); }
.btn-danger-outline { color: var(--danger); border-color: var(--danger-bg); background: transparent; }
.btn-danger-outline:hover { background: var(--danger-bg); }

/* Form Controls */
.form-control {
  width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.95rem; color: var(--text-main); transition: var(--transition);
  background: var(--bg-surface);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.input-group { margin-bottom: 1.2rem; }
.input-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-main); margin-bottom: 0.4rem; }

/* Layout & Typography */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; width: 100%; flex: 1; }
.section-header { margin-bottom: 2rem; display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 768px) {
  .section-header { flex-direction: row; justify-content: space-between; align-items: center; }
}
.section-header h1 { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; color: var(--text-main); }

/* Card */
.card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); transition: var(--transition); overflow: hidden;
}

/* Modern Wholesale Table (List View) */
.product-list { display: flex; flex-direction: column; gap: 0.75rem; transition: all 0.2s ease; }
.product-row {
  display: grid;
  grid-template-columns: 60px 2fr 1fr 1fr 180px;
  align-items: center; gap: 1rem;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.75rem 1rem; transition: var(--transition); box-shadow: var(--shadow-sm);
}
.product-row:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.product-row img { width: 60px; height: 60px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--border); background: var(--bg-main); }
.product-info { display: flex; flex-direction: column; }
.product-title { font-weight: 600; font-size: 1rem; color: var(--text-main); }
.product-sku { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.product-price { font-weight: 600; font-size: 1.1rem; color: var(--text-main); }
.product-price-hidden { font-size: 0.9rem; color: var(--text-muted); background: var(--bg-hover); padding: 0.2rem 0.5rem; border-radius: var(--radius-md); display: inline-block; width: fit-content; border: 1px dashed var(--border);}
.product-actions { display: flex; align-items: center; gap: 0.6rem; justify-content: flex-end;}
.qty-input { width: 60px; text-align: center; }

/* Grid View Setup (Lekons Card fallback Grid) */
.product-list.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}
.product-list.grid-view .product-row {
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  text-align: center;
}
.product-list.grid-view .product-row img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  margin-bottom: 1rem;
}
.product-list.grid-view .product-info {
  margin-bottom: 0.5rem;
  align-items: center;
}
.product-list.grid-view .product-actions {
  justify-content: center;
  width: 100%;
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

/* Badges */
.badge { padding: 0.2rem 0.6rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; width: fit-content;}
.badge-success { background: var(--success-bg); color: #065f46; /* darker green for text */ }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger { background: var(--danger-bg); color: #991b1b; }
.badge-neutral { background: var(--bg-hover); color: var(--text-muted); }

/* Catalog Responsive Container w/ Sidebar Filter */
.catalog-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.8rem;
    align-items: flex-start;
    margin-top: 1.5rem;
}
.catalog-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 4.5rem;
}
.sidebar-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #475569;
    cursor: pointer;
}
.filter-label input[type="checkbox"] {
    accent-color: #e11d48;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

@media (max-width: 900px) {
    .catalog-container {
        grid-template-columns: 1fr;
    }
    .catalog-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 260px;
        z-index: 100;
        border-radius: 0;
        box-shadow: var(--shadow-xl);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }
    .catalog-sidebar.active {
        transform: translateX(280px);
    }
}

/* Search Bar */
.search-bar-container { position: relative; width: 100%; max-width: 400px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none;}
.search-bar-container input { padding-left: 2.5rem; border-radius: var(--radius-full); }

/* Cart Drawer */
.cart-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.6); z-index: 50; opacity: 0; visibility: hidden; transition: var(--transition); }
.cart-overlay.active { opacity: 1; visibility: visible; }
.cart-drawer { position: fixed; right: -420px; top: 0; bottom: 0; width: 100%; max-width: 420px; background: var(--bg-surface); z-index: 51; box-shadow: var(--shadow-drawer); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; border-left: 1px solid var(--border);}
.cart-drawer.active { transform: translateX(-420px); }
.cart-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg-surface); z-index: 2;}
.cart-header h2 { font-size: 1.25rem; font-weight: 600; margin: 0; }
.cart-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); transition: var(--transition); display: flex; align-items: center; justify-content: center;}
.cart-close:hover { color: var(--text-main); }
.cart-body { padding: 1.5rem; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.cart-item { display: grid; grid-template-columns: 50px 1fr auto; gap: 1rem; align-items: center; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.cart-item img { width: 50px; height: 50px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--border);}
.cart-item-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.2rem;}
.cart-item-price { font-weight: 600; font-size: 0.95rem; color: var(--primary); }
.cart-item-controls { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.cart-item-controls button { padding: 0.1rem 0.5rem; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-surface); cursor: pointer; font-family: inherit;}
.cart-item-controls button:hover { background: var(--bg-hover);}
.cart-item-controls span { font-size: 0.9rem; font-weight: 500; min-width: 20px; text-align: center;}
.cart-footer { padding: 1.5rem; border-top: 1px solid var(--border); background: var(--bg-main); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }

/* Alerts */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius-md); margin-bottom: 1.5rem; display: flex; gap: 0.75rem; align-items: flex-start; font-size: 0.95rem; line-height: 1.4; border: 1px solid transparent;}
.alert-warning { background: var(--warning-bg); border-color: rgba(245, 158, 11, 0.3); color: #92400e; }
.alert-info { background: #eff6ff; border-color: rgba(59, 130, 246, 0.3); color: #1e40af; }
.alert-success { background: var(--success-bg); border-color: rgba(16, 185, 129, 0.3); color: #065f46; }

/* Auth Box */
.auth-box { background: var(--bg-surface); border: 1px solid var(--border); padding: 2.5rem; border-radius: var(--radius-lg); max-width: 400px; width: 100%; margin: 4rem auto; box-shadow: var(--shadow-md); }
.auth-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-main); }
.auth-subtitle { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 2rem; }

/* Dashboard Tables */
.table-container { overflow-x: auto; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 2rem;}
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg-hover); }
td { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); font-size: 0.95rem; vertical-align: middle;}
tr:hover td { background: var(--bg-hover); }
tr:last-child td { border-bottom: none; }

/* Dashboard Cards */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.dash-card { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.dash-card-title { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }
.dash-card-value { font-size: 2rem; font-weight: 700; color: var(--text-main); }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none;}
.toast { background: var(--bg-surface); border: 1px solid var(--border); padding: 1rem 1.5rem; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, fadeOut 0.3s ease 2.7s forwards; display: flex; align-items: center; gap: 0.75rem; font-weight: 500; font-size: 0.95rem; color: var(--text-main); pointer-events: auto;}
.toast svg { color: var(--success); width: 20px; height: 20px; }
@keyframes slideIn { from { transform: translateX(100%) scale(0.9); opacity: 0; } to { transform: translateX(0) scale(1); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Mobile */
@media (max-width: 768px) {
  .product-row { grid-template-columns: 1fr; gap: 0.5rem; padding: 1rem; }
  .product-row img { display: none; }
  .product-actions { justify-content: flex-start; margin-top: 0.5rem; width: 100%;}
  .product-actions .btn { flex: 1; }
  .section-header { flex-direction: column; align-items: flex-start; }
  nav { padding: 1rem; flex-wrap: wrap; gap: 1rem; }
  .search-bar-container { max-width: 100%; }
}
