/* ============================================================
   Nettrans — app.css
   Aesthetic: Industrial / Logistics — dark navy + high-vis amber
   ============================================================ */

:root {
  --navy:       #0d1b2a;
  --navy-mid:   #1a2e45;
  --navy-light: #243c58;
  --amber:      #f4a70a;
  --amber-dark: #d4880a;
  --amber-pale: #fef3cd;
  --sky:        #3a9bd5;
  --green:      #28a745;
  --red:        #dc3545;
  --orange:     #fd7e14;
  --white:      #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-400:   #94a3b8;
  --gray-600:   #475569;
  --gray-800:   #1e293b;
  --radius:     4px;
  --radius-lg:  8px;
  --shadow:     0 2px 8px rgba(0,0,0,.18);
  --shadow-lg:  0 4px 24px rgba(0,0,0,.25);
  font-size: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Barlow', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TOP NAV ───────────────────────────────────────────────── */
.topnav {
  background: var(--navy);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 52px;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-right: 1rem;
}
.brand-icon { color: var(--amber); font-size: 1.3rem; }
.brand-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--white);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topnav-links { display: flex; gap: .25rem; flex: 1; }
.navlink {
  color: var(--gray-400);
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: .35rem .75rem;
  border-radius: var(--radius);
  transition: color .15s, background .15s;
}
.navlink:hover, .navlink.active {
  color: var(--amber);
  background: rgba(244,167,10,.1);
  text-decoration: none;
}

.topnav-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
}
.user-badge {
  color: var(--gray-400);
  font-size: .82rem;
}

/* ── MAIN ──────────────────────────────────────────────────── */
.main-container {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.app-footer {
  text-align: center;
  padding: .75rem;
  font-size: .78rem;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
}

/* ── ALERTS ────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 500;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error    { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info     { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius);
  border: none;
  font-family: 'Barlow', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn-primary   { background: var(--amber);    color: var(--navy); }
.btn-secondary { background: var(--navy-mid); color: var(--white); }
.btn-success   { background: var(--green);    color: #fff; }
.btn-danger    { background: var(--red);      color: #fff; }
.btn-info      { background: var(--sky);      color: #fff; }
.btn-outline   { background: transparent; color: var(--gray-400); border: 1px solid var(--gray-600); }
.btn-outline:hover { color: var(--white); border-color: var(--white); }
.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: .4rem .55rem; }

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  background: var(--navy);
  color: var(--white);
  padding: .75rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2, .card-header h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.card-header-amber { background: var(--amber); color: var(--navy); }
.card-body { padding: 1.2rem; }

/* ── PAGE HEADER ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  text-transform: uppercase;
  color: var(--navy);
  letter-spacing: .04em;
}
.page-title span { color: var(--amber); }

/* ── TABS ───────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 1.25rem; }
.tab-btn {
  background: none; border: none;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: .95rem;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--gray-600);
  padding: .6rem 1.2rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--amber-dark); border-bottom-color: var(--amber); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem 1rem;
}
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-full   { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: .25rem; }
.form-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-600);
}
.form-label .req { color: var(--red); }

.form-control {
  width: 100%;
  padding: .45rem .65rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: 'Barlow', sans-serif;
  font-size: .9rem;
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(58,155,213,.18);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.section-divider {
  grid-column: 1 / -1;
  border: none;
  border-top: 2px solid var(--navy);
  margin: .5rem 0 .25rem;
  position: relative;
}
.section-label {
  grid-column: 1 / -1;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--navy);
  background: var(--navy);
  color: var(--amber);
  padding: .25rem .75rem;
  border-radius: var(--radius);
  display: inline-block;
  width: fit-content;
}

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead tr { background: var(--navy); color: var(--white); }
thead th {
  padding: .6rem .85rem;
  text-align: left;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--gray-200); transition: background .1s; }
tbody tr:hover { background: var(--gray-100); }
tbody td { padding: .55rem .85rem; vertical-align: middle; }
tbody tr:nth-child(even) { background: #f9fbfd; }
tbody tr:nth-child(even):hover { background: var(--gray-100); }

/* ── STATUS BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.badge-quote      { background: #e2e8f0; color: #475569; }
.badge-confirmed  { background: #d1fae5; color: #065f46; }
.badge-in_transit { background: #fef3c7; color: #92400e; }
.badge-delivered  { background: #dbeafe; color: #1e40af; }
.badge-invoiced   { background: #ede9fe; color: #5b21b6; }
.badge-cancelled  { background: #fee2e2; color: #991b1b; }

/* ── DASHBOARD STATS ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--amber);
}
.stat-card.blue  { border-left-color: var(--sky); }
.stat-card.green { border-left-color: var(--green); }
.stat-card.red   { border-left-color: var(--red); }
.stat-label { font-size: .73rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-600); }
.stat-value { font-family: 'Barlow Condensed', sans-serif; font-size: 2rem; font-weight: 800; color: var(--navy); margin-top: .15rem; }

/* ── INVENTORY TABLE ────────────────────────────────────────── */
#inventory-table input { padding: .3rem .4rem; font-size: .85rem; }
#inventory-table td { padding: .3rem .4rem; }
.inv-total-row td { background: var(--navy); color: var(--white); font-weight: 700; }

/* ── TWO-PANEL LAYOUT ───────────────────────────────────────── */
.two-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.panel-header {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--white);
  background: var(--navy-mid);
  padding: .5rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
}
.panel-header.amber { background: var(--amber); color: var(--navy); }
.panel-body { background: var(--white); padding: 1rem; border: 1px solid var(--gray-200); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }

/* ── SEARCH BOX ────────────────────────────────────────────── */
.search-bar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-bar .form-control { max-width: 320px; }

/* ── ACTIONS COL ────────────────────────────────────────────── */
.actions { display: flex; gap: .35rem; }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  background: var(--navy);
  color: var(--white);
  padding: .75rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.modal-close { background: none; border: none; color: var(--gray-400); font-size: 1.4rem; cursor: pointer; }
.modal-body { padding: 1.2rem; }
.modal-footer { padding: .75rem 1.2rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: .5rem; }

/* ── PRINT / BOL ────────────────────────────────────────────── */
@media print {
  .topnav, .app-footer, .no-print { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .main-container { padding: 0; max-width: 100%; }
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .two-panel   { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topnav-links { display: none; }
  .form-grid, .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3, .col-span-4 { grid-column: span 1; }
}

/* autocomplete dropdown */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute;
  z-index: 150;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  list-style: none;
  margin-top: 2px;
}
.autocomplete-list li {
  padding: .45rem .75rem;
  cursor: pointer;
  font-size: .88rem;
  border-bottom: 1px solid var(--gray-100);
}
.autocomplete-list li:hover { background: var(--gray-100); }
