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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  color: #333;
  line-height: 1.5;
}

/* Header */
.header {
  background: linear-gradient(135deg, #1a5fb4, #2a7cc7);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.3rem;
  font-weight: bold;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-weight: 500;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 20px;
}

/* Typography */
h1 {
  margin: 20px 0;
  color: #1a5fb4;
  font-size: 1.6rem;
}

/* Search Box */
.search-box {
  margin-bottom: 20px;
}

#search {
  width: 100%;
  max-width: 500px;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

th {
  background-color: #f1f5f9;
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  color: #2d3748;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
}

td {
  padding: 10px;
  border-bottom: 1px solid #edf2f7;
}

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

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

/* Loading & Messages */
#loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* Footer note (optional reuse) */
.footer-note {
  margin-top: 20px;
  font-size: 0.85rem;
  color: #718096;
  text-align: center;
}



.sidebar {
  width: 240px;
  background: #2d3748;
  color: white;
  padding-top: 1rem;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  z-index: 90;
}

.nav-menu hr {
  border: 0;
  border-top: 1px solid #4a5568;
  margin: 12px 0;
}

.nav-item {
  padding: 12px 24px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 1rem;
  user-select: none;
}

.nav-item:hover, .nav-item.active {
  background: #3e4a5c;
}

/* Main content offset */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 20px;
}


/* Metrics Grid - Professional Look */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-tile {
    background: white;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.metric-tile .label { font-size: 0.75rem; color: #757575; text-transform: uppercase; font-weight: 600; }
.metric-tile .value { font-size: 1.8rem; font-weight: 700; color: #212121; margin: 5px 0; font-family: monospace; }
.metric-tile .trend { font-size: 0.7rem; font-weight: 600; }
.trend.success { color: #2e7d32; }
.trend.danger { color: #c62828; }

/* Filter Card */
.filter-card {
    background: #f8f9fa;
    padding: 15px 20px;
    border: 1px solid #ccc;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.85rem;
}

.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group input, .filter-group select {
    padding: 5px;
    border: 1px solid #ccc;
    font-family: monospace;
}

.btn-clear { background: none; border: none; color: #d32f2f; cursor: pointer; text-decoration: underline; }

/* Breadcrumb */
.breadcrumb { font-size: 0.8rem; color: #888; margin-bottom: 10px; }
.header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

/* Container to push title left and buttons right */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Ensure buttons have consistent spacing */
.action-buttons {
    display: flex;
    gap: 10px;
}

/* Standardized Button Style */
.btn-secondary {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #999;
}

/* Container for the table to allow horizontal scrolling if needed */
.table-wrapper {
    overflow-x: auto;
    margin-top: 10px;
    border: 1px solid #ccc;
}

/* The Main Console Style */
.console-style-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace; /* Monospaced font */
    font-size: 13px;
    background-color: #fff;
    color: #333;
}

.console-style-table th {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    padding: 4px 8px;
    text-align: left;
    font-weight: bold;
    color: #555;
}

.console-style-table td {
    border: 1px solid #ccc;
    padding: 2px 8px;
    white-space: nowrap;
}

/* Index column styling (the grey left column in console.table) */
.index-col {
    background-color: #f0f0f0;
    color: #888;
    text-align: right;
    width: 40px;
}

/* SKU styling to look like a JS string */
.sku-col {
    color: #c41a16; /* Dark red, like string colors in console */
}

/* Zebra striping for readability */
.console-style-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Hover effect */
.console-style-table tr:hover {
    background-color: #e8f0fe;
}

/* Highlight losses in red bold */
.cell-warning {
    color: #d93025;
    font-weight: bold;
}

/* Search Input Styling */
.filter-section input {
    font-family: monospace;
    padding: 6px;
    border: 1px solid #ccc;
    width: 250px;
    margin-bottom: 5px;
    outline: none;
}

.filter-section input:focus {
    border-color: #2196f3;
}

/* Header toolbar (breadcrumb + quick search) */
.header-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.header-toolbar .breadcrumb {
    margin: 0;
}

.quick-search {
    display: flex;
    gap: 8px;
    align-items: center;
}

.quick-search input {
    padding: 8px;
    width: 200px;
    font-family: monospace;
}

.btn-primary {
    padding: 8px 15px;
    cursor: pointer;
    background: #1a5fb4;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 500;
}

.btn-primary:hover {
    background: #164f96;
}

.page-title {
    margin: 0;
}

.loading-block {
    padding: 20px;
}

.empty-state {
    display: none;
    text-align: center;
    padding: 100px 20px;
}

.empty-state .empty-state-icon {
    font-size: 5rem;
}

/* Color-coded status badges (shared across ledger pages) */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.status-badge.status-low {
    background: #fde8e8;
    color: #c0392b;
}
.status-badge.status-pending {
    background: #fff3e0;
    color: #e65100;
}
.status-badge.status-ok {
    background: #e8f5e9;
    color: #27ae60;
}

/* Editable row hover effect */
.row-editable {
    cursor: pointer;
}
.row-editable:hover {
    background-color: #e8f0fe !important;
}

/* ========================================
   Tabulator.js Customizations
   ======================================== */
.tabulator {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    border: none;
}

.tabulator-row:hover {
    background-color: #e8f0fe !important;
}

.tabulator-row.tabulator-row-even {
    background-color: #f9f9f9;
}

.tabulator-header {
    background-color: #f1f5f9;
    border-bottom: 2px solid #cbd5e1;
}

.tabulator-col-title {
    font-weight: 600;
    color: #334155;
}

.tabulator .tabulator-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 8px 10px;
}

.tabulator-page {
    margin: 0 4px;
    padding: 4px 8px;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
}

.tabulator-page:hover {
    background: #e8f0fe;
}

.tabulator-page.active {
    background: #1a5fb4;
    color: white;
    border-color: #1a5fb4;
}

/* Keep existing utility classes for Tabulator formatters */
.cell-warning {
    color: #c0392b;
    font-weight: bold;
}
