/* ============================================================
   GROSIR (ADMIN / DISTRIBUTOR) DASHBOARD STYLES
   ============================================================ */

.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

/* Admin Sidebar */
.admin-sidebar {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  padding: 1.25rem 0.85rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: fit-content;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--slate-600);
  font-weight: 600;
  font-size: 0.875rem;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.admin-nav-item:hover {
  background: var(--slate-50);
  color: var(--slate-900);
}

.admin-nav-item.active {
  background: var(--primary-50);
  color: var(--primary-800);
  border-color: var(--primary-200);
  font-weight: 700;
}

.admin-nav-item.active svg {
  color: var(--primary-700);
}

.admin-nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

/* Stats Metric Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

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

.stat-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--slate-900);
  margin-top: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-500);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.primary { background: var(--primary-100); color: var(--primary-700); }
.stat-icon.warning { background: #fef3c7; color: #d97706; }
.stat-icon.danger { background: #fee2e2; color: #dc2626; }
.stat-icon.success { background: #dcfce7; color: #16a34a; }

/* Admin Content Card & Table */
.admin-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--slate-900);
}

/* Data Table Component */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
}

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

.custom-table th {
  background: var(--slate-50);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--slate-600);
  border-bottom: 1px solid var(--slate-200);
  text-transform: uppercase;
  font-size: 0.725rem;
  letter-spacing: 0.04em;
}

.custom-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-800);
  vertical-align: middle;
}

.custom-table tr:hover td {
  background: var(--slate-50);
}

/* Low Stock Alert Banner */
.low-stock-alert-bar {
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  border: 1px solid #fecdd3;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.low-stock-alert-text {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #9f1239;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Admin Chat Split Layout */
.admin-chat-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  height: 600px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  .admin-chat-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.chat-rooms-list {
  border-right: 1px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: #ffffff;
}

.chat-room-item {
  padding: 1rem;
  border-bottom: 1px solid var(--slate-100);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.chat-room-item:hover {
  background: var(--slate-50);
}

.chat-room-item.active {
  background: var(--primary-50);
  border-left: 3px solid var(--primary-700);
}

.chat-room-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.chat-room-info {
  flex: 1;
  min-width: 0;
}

.chat-room-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--slate-900);
  display: flex;
  justify-content: space-between;
}

.chat-room-preview {
  font-size: 0.775rem;
  color: var(--slate-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.2rem;
}

/* Thermal Invoice / Surat Jalan Print Preview */
.printable-invoice {
  font-family: 'Courier New', Courier, monospace;
  background: #ffffff;
  color: #000000;
  padding: 1.5rem;
  max-width: 480px;
  margin: 0 auto;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
}

.invoice-header {
  text-align: center;
  border-bottom: 2px dashed #000;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.invoice-header h2 {
  font-size: 1.25rem;
  font-weight: 900;
  margin-bottom: 0.25rem;
  color: #000;
}

.invoice-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.8rem;
}

.invoice-table th {
  border-top: 1px dashed #000;
  border-bottom: 1px dashed #000;
  padding: 0.35rem 0;
  text-align: left;
}

.invoice-table td {
  padding: 0.35rem 0;
}

.invoice-total-section {
  border-top: 2px dashed #000;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.invoice-items-list {
  border-top: 1px dashed #000;
  border-bottom: 2px dashed #000;
  padding: 0.6rem 0;
  margin: 0.75rem 0;
}

.invoice-item-entry {
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.invoice-item-entry:not(:first-child) {
  border-top: 1px dashed #cbd5e1;
  padding-top: 0.45rem;
}

.invoice-item-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: #000000;
  word-break: break-word;
}

.invoice-item-calc {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  color: #1e293b;
  margin-top: 2px;
}

.invoice-payment-status-row {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #94a3b8;
  font-weight: bold;
}

.status-unpaid {
  color: #dc2626 !important;
  font-weight: 800;
}

.status-paid {
  color: #166534 !important;
  font-weight: 800;
}

.invoice-footer-note {
  text-align: center;
  font-size: 0.75rem;
  margin-top: 1.25rem;
  border-top: 1px dashed #000;
  padding-top: 0.5rem;
}
