/* ==========================================================================
   WMS INTERACTIVE CLIENT DEMO — STYLESHEET
   Based on the production AB Digital WMS theme (#17324d) + Guided Tour UI
   ========================================================================== */

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

:root {
  --wms-navy: #102136;
  --wms-navy-light: #17324d;
  --wms-accent: #3b82f6;
  --wms-accent-glow: rgba(59, 130, 246, 0.45);
  --wms-bg: #f4f6f8;
  --wms-text: #1f2937;
  --wms-muted: #64748b;
  --wms-border: #e5e7eb;
  --chrome-height: 54px;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--wms-bg);
  color: var(--wms-text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================================================
   1. SIMULATED BROWSER CHROME / URL BAR (Step 1 Target)
   ========================================================================== */
.browser-chrome {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--chrome-height);
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  color: #e2e8f0;
  user-select: none;
}

.browser-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.browser-nav-btns {
  display: flex;
  gap: 4px;
}

.chrome-icon-btn {
  background: transparent;
  color: #94a3b8;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chrome-icon-btn:hover {
  background: #1e293b;
  color: #fff;
}

.browser-url-bar {
  flex: 1;
  max-width: 680px;
  margin: 0 auto;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: #f8fafc;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.ssl-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #34d399;
  font-weight: 600;
}

.url-domain {
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.url-path {
  color: #94a3b8;
}

.browser-actions {
  display: flex;
  align-items: center;
}

.restart-tour-btn {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.restart-tour-btn:hover {
  background: #334155;
  color: #fff;
}

/* ==========================================================================
   2. VIEWPORT SCREENS & TRANSITIONS
   ========================================================================== */
.viewport-screen {
  display: none;
  min-height: calc(100vh - var(--chrome-height));
  opacity: 0;
  transition: opacity 0.35s ease;
}

.viewport-screen.active-screen {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

/* ==========================================================================
   3. VIEW 1: LOGIN SCREEN & CUSTOM COMPANY BACKGROUND
   ========================================================================== */
.auth-background {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background-image: url('bg.jpg'), url('../Moin%20Halal/wms-demo/bg.jpg');
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
  background-size: cover;
  overflow: hidden;
}

/* Shadow container overlay to darken the background image */
.bg-shadow-container {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(6, 11, 22, 0.48) 0%, rgba(4, 8, 16, 0.76) 100%),
    rgba(6, 12, 24, 0.45);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  z-index: 1;
}

/* Background target zone for Step 2 (Positioned on the background, NOT the login box) */
.bg-brand-target {
  position: absolute;
  left: 7%;
  top: 26%;
  width: 240px;
  height: 150px;
  border-radius: 12px;
  z-index: 2;
  pointer-events: none;
}

.auth-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px 20px;
  position: relative;
  z-index: 3;
}

.auth-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  padding: 34px 36px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  text-align: center;
  transition: filter 0.35s ease, opacity 0.35s ease, box-shadow 0.35s ease;
}

/* Out-of-focus state for the login box during Step 2 (background highlight) */
.auth-card.tour-out-of-focus {
  filter: brightness(0.32) blur(3px);
  opacity: 0.72;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55), 0 16px 40px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.auth-card h1 {
  font-size: 20px;
  color: var(--wms-navy);
  margin: 0 0 22px;
  letter-spacing: 0.4px;
}

.auth-card .form-group {
  max-width: 290px;
  margin: 0 auto 14px;
  text-align: left;
}

.auth-card label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}

.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  background: #f8fafc;
  color: #1e293b;
}

.btn-primary,
.btn {
  background: var(--wms-navy);
  color: #fff;
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.btn-primary:hover,
.btn:hover {
  background: var(--wms-navy-light);
}

.auth-card .btn-primary {
  display: block;
  width: 100%;
  max-width: 290px;
  margin: 18px auto 0;
  padding: 11px;
}

.auth-links {
  margin-top: 20px;
  font-size: 13px;
}
.auth-links a {
  color: var(--wms-navy);
  text-decoration: none;
  font-weight: 700;
}
.auth-links a:hover {
  text-decoration: underline;
}
.auth-links .divider {
  margin: 0 8px;
  color: #94a3b8;
}

/* ==========================================================================
   4. VIEW 2: ADMIN DASHBOARD & WMS PORTAL
   ========================================================================== */
.wms-nav {
  position: relative;
  background: var(--wms-navy);
  color: #fff;
  padding: 12px 22px;
  display: flex;
  gap: 16px;
  flex-wrap: nowrap;
  align-items: center;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.wms-brand {
  font-size: 15px;
  letter-spacing: 0.5px;
  margin-right: 8px;
  white-space: nowrap;
}

.wms-hamburger {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 7px 9px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
}
.wms-hamburger:hover {
  background: rgba(255, 255, 255, 0.2);
}
.hamburger-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
}

.wms-nav-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  padding: 4px 6px;
  border-radius: 0;
}

.wms-tab {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.wms-tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.wms-tab.active {
  background: #ffffff;
  color: var(--wms-navy);
  font-weight: 700;
}

.wms-logout {
  margin-left: auto;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.wms-logout:hover {
  color: #fff;
  text-decoration: underline;
}

/* Switch to Hamburger Menu right before nav bar items would start stacking */
@media (max-width: 1020px) {
  .wms-nav {
    flex-wrap: wrap;
  }
  .wms-hamburger {
    display: inline-flex;
    order: 2;
    margin-left: auto;
  }
  .wms-logout {
    order: 3;
    margin-left: 10px;
  }
  .wms-nav-tabs {
    order: 4;
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    background: var(--wms-navy);
    margin-top: 8px;
    padding: 8px;
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
  }
  .wms-nav-tabs.nav-open {
    display: flex;
  }
  .wms-tab {
    padding: 9px 14px;
  }
}

.wms-main {
  flex: 1;
  max-width: 1380px;
  width: 100%;
  margin: 22px auto;
  padding: 0 20px;
}

.tab-panel {
  display: none;
}
.tab-panel.active-panel {
  display: block;
}

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.page-header-row h1 {
  margin: 0 0 4px;
  font-size: 24px;
  color: var(--wms-navy);
}

.page-header-row .muted {
  margin: 0;
  font-size: 14px;
}

/* Step 4 wrapper: symmetrical top and bottom spacing around cards */
.dashboard-highlight-wrapper {
  padding: 0;
  margin: 0;
  border-radius: 10px;
}
.dashboard-highlight-wrapper > .card:last-child {
  margin-bottom: 0;
}

/* 6 Stat Cards: always split into equal rows (6 -> 3 -> 2 -> 1) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 680px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: #fff;
  padding: 18px;
  border-radius: 10px;
  margin: 12px 0;
  box-shadow: 0 1px 4px #ccd3da;
}
.stats-grid .card {
  margin: 0;
}

.muted {
  color: var(--wms-muted);
  font-size: 13px;
  font-weight: 600;
}

.stat {
  font-size: 30px;
  font-weight: 800;
  color: var(--wms-navy);
  margin: 6px 0 4px;
}
.stat.stat-warn {
  color: #d97706;
}

.stat-sub {
  font-size: 12px;
  color: #64748b;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-header-flex h2 {
  margin: 0;
  font-size: 18px;
  color: var(--wms-navy);
}

.badge-live {
  background: #dcfce7;
  color: #15803d;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.tablewrap {
  overflow-x: auto;
  max-width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13.5px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(23, 50, 77, 0.08);
}

.data-table th {
  background: var(--wms-navy);
  color: #fff;
  text-align: center;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.data-table thead tr:first-child th:first-child {
  border-top-left-radius: 8px;
}

.data-table thead tr:first-child th:last-child {
  border-top-right-radius: 8px;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--wms-border);
  text-align: center;
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}
.data-table tbody tr:hover {
  background: #f1f5f9;
}

.status-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.status-ok {
  background: #dcfce7;
  color: #166534;
}
.status-hold {
  background: #fef3c7;
  color: #92400e;
}

/* Fake Edit Button in Admin Table */
.btn-edit-row {
  background: var(--wms-navy);
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-edit-row:hover {
  background: var(--wms-navy-light);
}

/* Header Button Group & Outline Button */
.header-btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-outline {
  background: #ffffff;
  color: var(--wms-navy);
  border: 1.5px solid var(--wms-navy);
}
.btn-outline:hover {
  background: #f1f5f9;
}

/* Search & Filter Toolbar Card */
.toolbar-card {
  padding: 12px 16px;
}

.toolbar-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-search {
  flex: 1 1 240px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--wms-text);
  background: #f8fafc;
}
.toolbar-search:focus {
  outline: none;
  border-color: var(--wms-navy);
  background: #ffffff;
}

.toolbar-select {
  flex: 0 1 190px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--wms-text);
  background: #ffffff;
}

.toolbar-filter-btn {
  padding: 9px 18px;
  white-space: nowrap;
}

/* Manual Entry Forms Under Tables */
.manual-entry-card {
  display: none;
  border-top: 3px solid var(--wms-navy);
  margin-top: 16px;
}

.manual-entry-card.form-open {
  display: block;
  animation: formFadeIn 0.25s ease;
}

@keyframes formFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.manual-form-header {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--wms-border);
}
.manual-form-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--wms-navy);
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 820px) {
  .form-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

.form-grid-3 label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
}

.form-grid-3 input,
.form-grid-3 select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--wms-text);
  background: #ffffff;
}
.form-grid-3 input[readonly] {
  background: #f1f5f9;
  color: #64748b;
}

.manual-form-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-secondary-cancel {
  background: #e2e8f0;
  color: #334155;
}
.btn-secondary-cancel:hover {
  background: #cbd5e1;
}

.form-saved-notice {
  font-size: 13px;
  font-weight: 700;
  color: #15803d;
  margin-left: 6px;
}

.wms-footer {
  text-align: center;
  padding: 14px 0;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  background: #0b111e;
}
.wms-footer.auth-footer {
  position: relative;
  z-index: 3;
  background: rgba(8, 13, 24, 0.78);
  border-top-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}
.wms-footer a {
  color: #4a90d9;
  font-weight: 700;
  text-decoration: none;
}

/* ==========================================================================
   5. GUIDED TOUR SPOTLIGHT, BEACON & POPOVER MODAL
   ========================================================================== */
.tour-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.25s ease;
}

.tour-layer.tour-hidden {
  opacity: 0;
  visibility: hidden;
}

.tour-spotlight {
  position: fixed;
  border-radius: 10px;
  border: 2.5px solid #38bdf8;
  box-shadow:
    0 0 0 9999px rgba(10, 18, 32, 0.52),
    0 0 24px 4px rgba(56, 189, 248, 0.55);
  transition:
    top 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.tour-spotlight.dashboard-spot {
  box-shadow: 0 0 24px 4px rgba(56, 189, 248, 0.55);
}

.tour-beacon {
  position: fixed;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
  animation: beaconPulse 1.6s infinite;
  transition:
    top 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

@keyframes beaconPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.8);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 14px rgba(56, 189, 248, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
  }
}

.tour-popover {
  position: fixed;
  width: 350px;
  max-width: calc(100vw - 28px);
  background: #0f172a;
  color: #f8fafc;
  border: 1.5px solid #38bdf8;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45), 0 0 20px rgba(56, 189, 248, 0.25);
  pointer-events: auto;
  transition:
    top 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.3s ease;
}

.tour-arrow {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #0f172a;
  transform: rotate(45deg);
}

.tour-popover[data-arrow="top"] .tour-arrow {
  top: -8px;
  left: var(--arrow-left, 50%);
  margin-left: -7px;
  border-top: 1.5px solid #38bdf8;
  border-left: 1.5px solid #38bdf8;
}

.tour-popover[data-arrow="left"] .tour-arrow {
  left: -8px;
  top: 28px;
  border-bottom: 1.5px solid #38bdf8;
  border-left: 1.5px solid #38bdf8;
}

.tour-popover[data-arrow="right"] .tour-arrow {
  right: -8px;
  top: 28px;
  border-top: 1.5px solid #38bdf8;
  border-right: 1.5px solid #38bdf8;
}

.tour-popover[data-arrow="bottom"] .tour-arrow {
  bottom: -8px;
  left: var(--arrow-left, 50%);
  margin-left: -7px;
  border-bottom: 1.5px solid #38bdf8;
  border-right: 1.5px solid #38bdf8;
}

.tour-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.tour-step-badge {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.tour-dots {
  display: flex;
  gap: 5px;
}

.tour-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tour-dot.active {
  width: 18px;
  border-radius: 999px;
  background: #38bdf8;
}

.tour-popover-text {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  color: #f1f5f9;
}

.tour-popover-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tour-btn-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tour-btn-secondary:hover:not(:disabled) {
  background: #334155;
  color: #fff;
}
.tour-btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tour-btn-primary {
  background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transition: transform 0.12s ease, filter 0.15s ease;
}
.tour-btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

@media (max-width: 960px) {
  .bg-brand-target {
    left: 6%;
    top: 10%;
    width: 180px;
    height: 90px;
  }
}
