﻿/* RESET & BASE LAYOUT */
* { margin:0; padding:0; box-sizing:border-box; }
html, body { 
  height:100%; font-family:Arial,sans-serif; background:#5a6069; 
}

/* Sidebar Hover Zone */
.hover-zone { 
  position:fixed; top:0; left:0; width:60px; height:100%; z-index:999; 
}
.page-wrapper { display:flex; flex-direction:column; min-height:100vh; }

/* HEADER (site-level) */
header {
  position: fixed;
  top: 0;
  left: 60px;
  background-color: #225094; color: white; padding: 15px 0;
  display: flex; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 1000;
  width: calc(100% - 60px);
  transition: left 0.3s ease, width 0.3s ease;
}
header.compressed {
  left: 180px;
  width: calc(100% - 180px);
}
.logo {
  margin-left: 30px; display: flex; align-items: center; gap: 10px;
  font-size: 1.5rem; color: white; text-decoration: none; font-weight: 600;
}

/* SIDEBAR */
.sidebar {
  position:fixed; top:0; left:0; height:100%; width:60px; background:#343a40; 
  color:white; z-index:100; overflow-x:hidden; transition:width 0.3s ease;
}
.sidebar.expanded { width:180px; }
.sidebar-menu { padding-top:100px; }
.sidebar-menu a {
  display: flex; align-items: center; padding: 15px 20px; text-decoration: none;
  color: #ccc; white-space: nowrap; transition: background-color 0.2s;
}
.sidebar-menu a:hover { background-color: #495057; color: white; }
.sidebar-menu a i { font-size: 1.2rem; width: 20px; }
.sidebar-menu a span { margin-left: 25px; font-size: 1.1rem; }
.sidebar.expanded .sidebar-menu a span { display:inline; }
.sidebar-menu a.active-link { background-color: #225094; color: white; }

/* CONTENT AREA */
.content-area {
  flex-grow: 1; display: flex; flex-direction: column; 
  margin-left: 60px;
  padding-top: 70px;
  transition: margin-left 0.3s ease;
  background: #f8f9fa;
  color: #333;
}
.content-area.compressed { margin-left:180px; }

main { padding: 30px; flex-grow: 1; }
footer { 
  padding: 15px 30px; border-top: 1px solid #e9ecef; 
  text-align: center; color: #6c757d; font-size: 0.9rem;
}

/* Standard Elements */
h1 { color: #225094; margin-bottom: 20px; }
.card { background: white; padding: 25px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 1rem;
}
.btn-primary {
  background-color: #28a745; color: white; padding: 10px 20px; border: none;
  border-radius: 5px; cursor: pointer; font-size: 1rem; transition: background-color 0.2s;
}
.btn-primary:hover { background-color: #218838; }

/* Generic ghost button (used for filters) */
.btn-ghost {
  background: transparent;
  border: 1px solid #ced4da;
  color: #495057;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-ghost:hover {
  background-color: #f1f3f5;
}

/* --- Page Specific Styles --- */

/* submit.php (legacy simple groups; kept for compatibility if used elsewhere) */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; color: #225094; }
.form-group-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* These are old submit group styles; transfer UI uses its own classes */
.item-groups-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px; }
.item-group { border: 1px solid #ced4da; padding: 20px; border-radius: 6px; background: #fff; }
.item-group h3 { margin-bottom: 15px; color: #007bff; font-size: 1.2rem; }
.item-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.item-row:last-child { border-bottom: none; }
.item-row label { flex-grow: 1; margin-right: 20px; font-weight: normal; color: #333; }
.item-row input[type="number"], .item-row input[type="text"] { width: 120px; padding: 6px 8px; font-size: 0.9rem; }
.item-row input[type="text"] { flex-grow: 1; }
textarea { resize: vertical; }

/* Older left-border emphasis; not applied to stock panels */
.item-group { border-left: 5px solid #225094; }
.item-group:nth-child(2) { border-left-color: #28a745; }
.item-group:nth-child(3) { border-left-color: #ffc107; }

/* inventory.php */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.summary-card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border-left: 5px solid #007bff; }
.summary-card h3 { color: #6c757d; font-size: 1rem; margin-bottom: 5px; }
.summary-card .value { font-size: 2rem; font-weight: bold; color: #225094; }
.filter-bar { display: flex; gap: 15px; margin-bottom: 20px; align-items: center; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 8px 12px; border: 1px solid #ced4da; border-radius: 4px; }
.item-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; }
.item-table th, .item-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #e9ecef; }
.item-table th { background: #f1f1f1; color: #333; font-weight: 600; }
.item-table tr:hover { background-color: #f8f9fa; }
.low-stock { color: #dc3545; font-weight: bold; }
.in-stock { color: #28a745; }
.submission-history { margin-top: 30px; }
.submission-item { border: 1px solid #e9ecef; padding: 10px; margin-bottom: 10px; border-radius: 4px; background: #fff; }
.submission-meta { font-size: 0.9rem; color: #6c757d; margin-bottom: 5px; }
.submission-items { font-size: 0.95rem; }
.empty-state { text-align: center; padding: 50px; color: #6c757d; font-style: italic; }

/* logs.php */
.log-table-container { overflow-x: auto; max-width: 100%; background: white; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.log-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.log-table th, .log-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #e9ecef; }
.log-table th { background: #f1f1f1; color: #333; font-weight: 600; cursor: pointer; }
.log-table tr:hover { background-color: #f8f9fa; }
.log-table .type-usage { color: #dc3545; font-weight: 700; }

/* -------------------------
   LiteWire modal for Logs page
   ------------------------- */
.lw-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.lw-modal.open,
.lw-modal[aria-hidden="false"] {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.lw-modal .lw-modal-content {
  background: #ffffff;
  color: #222;
  border-radius: 8px;
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 20px;
  position: relative;
  box-sizing: border-box;
  font-family: inherit;
}

.lw-modal .lw-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 6px;
  border-radius: 4px;
}
.lw-modal .lw-modal-close:hover { color: #111; background: rgba(0,0,0,0.04); }

.lw-modal .form-group { margin-bottom: 12px; }
.lw-modal .form-group label { display:block; font-weight:600; margin-bottom:6px; color:#333; }
.lw-modal input[type="text"], .lw-modal input[type="date"], .lw-modal select {
  width:100%;
  padding:8px 10px;
  border:1px solid #d0d0d0;
  border-radius:4px;
  box-sizing:border-box;
  background:#fff;
}
.lw-modal .form-group-row { display:flex; gap:12px; }
.lw-modal .form-group-row .form-group { flex:1; }

.lw-modal .form-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:16px; }
.lw-modal .btn { padding:8px 12px; border-radius:4px; border:1px solid transparent; cursor:pointer; }
.lw-modal .btn-primary { background:#0b66c3; color:#fff; border-color:#095aa8; }
.lw-modal .btn-danger { background:#d9534f; color:#fff; border-color:#c9302c; }

@media (max-width:520px) {
  .lw-modal .lw-modal-content { padding:14px; max-width: 95%; }
  .lw-modal .form-group-row { flex-direction:column; }
}

/* =========================================================
   INVENTORY TRANSFER UI (submit.php)
   ========================================================= */

/* Panels container */
.stock-panels {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.stock-panel {
  flex: 1 1 320px;
  position: relative;
  padding: 16px;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 6px;
}

/* Header with accent + location dropdown */
.stock-panel-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.stock-panel-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.stock-panel-accent {
  width: 4px;
  height: 28px;
  border-radius: 999px;
}

.stock-panel-accent-left {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}

.stock-panel-accent-right {
  background: linear-gradient(180deg, #22c55e, #16a34a);
}

.stock-panel-header select.location-select {
  flex: 1;
  padding: 8px;
  font-size: 0.95rem;
}

/* Filters */
.stock-panel-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-filter.active {
  background-color: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.3);
}

/* Column headers for items */
.stock-panel-columns {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.7fr;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  padding: 4px 6px 4px 6px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 4px;
}

.stock-panel-columns .col-item {
  text-align: left;
}
.stock-panel-columns .col-total,
.stock-panel-columns .col-change {
  text-align: right;
}

/* Scrollable list */
.stock-panel-items {
  max-height: 380px;
  overflow-y: auto;
  border-radius: 6px;
  background-color: rgba(15, 23, 42, 0.02);
  padding: 6px;
}

/* Item row */
.stock-item {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.7fr;
  align-items: center;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.08s ease, border-color 0.1s ease;
  font-size: 0.9rem;
  border: 1px solid transparent;
  margin-bottom: 4px;
}

.stock-item:hover {
  background-color: rgba(148, 163, 184, 0.1);
  transform: translateY(-1px);
}

.stock-item-label {
  margin-right: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-item-current,
.stock-item-adjust {
  font-size: 0.8rem;
  color: #64748b;
  text-align: right;
  margin-left: 8px;
}

/* Border intensity: 1–5 distinct colors */
.border-step-1 { border-color: rgba(59, 130, 246, 0.5); }   /* light blue */
.border-step-2 { border-color: rgba(37, 99, 235, 0.9); }    /* medium/strong blue */
.border-step-3 { border-color: rgba(147, 51, 234, 0.9); }   /* purple */
.border-step-4 { border-color: rgba(34, 197, 94, 0.95); }   /* green */
.border-step-5 { border-color: rgba(239, 68, 68, 0.95); }   /* red */

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}