:root {
  --sidebar-primary-bg: #1a237e;
  --sidebar-secondary-bg: #0d47a1;
  --sidebar-hover: #1565c0;
  --content-bg: #f8f9fa;
  --accent-color: #4db6ac;
  --text-white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
}

body {
  background-color: var(--content-bg);
  font-family: 'Sarabun', sans-serif;
  overflow-x: hidden;
}

/* Single Sidebar Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

#sidebar {
  width: 300px;
  background: var(--sidebar-primary-bg);
  position: fixed;
  height: 100vh;
  z-index: 1001;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#content {
  flex-grow: 1;
  margin-left: 300px;
  width: calc(100% - 300px);
  background: #ffffff;
  min-height: 100vh;
  position: relative;
}


.sidebar-header {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  color: white;
}

/* Custom Scrollbar for Sidebar */
#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}


.nav-item-single {
  display: flex;
  align-items: center;
  padding: 8px 25px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item-single i {
  font-size: 1.2rem;
  margin-right: 15px;
  width: 25px;
  text-align: center;
}

.nav-item-single:hover,
.nav-item-single.active {
  color: var(--text-white);
  background: var(--sidebar-hover);
}

.nav-item-single.active {
  border-left: 4px solid var(--accent-color);
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-section-title {
  padding: 15px 25px 5px;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: color 0.2s;
}

.sidebar-section-title:hover {
  color: rgba(255, 255, 255, 0.6);
}

.sidebar-section-title .bi-chevron-down {
  font-size: 0.6rem;
  transition: transform 0.3s;
}

.sidebar-section-title.collapsed .bi-chevron-down {
  transform: rotate(-90deg);
}

.collapsible-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.collapsible-content.collapsed {
  max-height: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  padding: 20px;
}

/* AI Panel Styles */
.ai-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: fit-content;
  position: sticky;
  top: 20px;
}

.ai-panel-header {
  font-weight: 800;
  color: #37474f;
  font-size: 0.9rem;
  border-bottom: 2px solid #eceff1;
  padding-bottom: 10px;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-widget {
  background: #fafafa;
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid #f0f0f0;
}

.ai-widget-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #546e7a;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.ai-prediction-card {
  background: #fff3e0;
  border-left: 4px solid #ff9800;
  padding: 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.ai-prediction-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  filter: brightness(0.98);
}

/* Primary Sidebar Items */
.primary-nav-item {
  width: 100%;
  padding: 15px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 0.75rem;
}

.primary-nav-item i {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.primary-nav-item:hover,
.primary-nav-item.active {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.1);
}

.primary-nav-item.active {
  border-left: 4px solid var(--accent-color);
}

/* Secondary Sidebar Items */
.secondary-nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.secondary-nav-item i {
  font-size: 1.2rem;
  margin-right: 12px;
  width: 24px;
  text-align: center;
}

.secondary-nav-item:hover,
.secondary-nav-item.active {
  color: var(--text-white);
  background: var(--sidebar-hover);
}

/* Dashboard UI Elements */
.view-title {
  font-weight: 700;
  color: #1a237e;
  margin-bottom: 1.5rem;
}

.stat-card {
  border: none;
  border-radius: 12px;
  padding: 1.25rem;
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-info {
  z-index: 1;
}

.stat-card-icon {
  font-size: 2.5rem;
  opacity: 0.2;
}

.bg-po-total {
  background: #3c78d8;
}

.bg-po-urgent {
  background: #e06666;
}

.bg-po-pending {
  background: #ffd966;
  color: #7f6000 !important;
}

.bg-po-completed {
  background: #6aa84f;
}

/* Tracking Timeline Styles */
.tracking-timeline {
  position: relative;
  padding: 20px 0;
}

.tracking-item {
  display: flex;
  gap: 20px;
  padding-bottom: 30px;
  position: relative;
}

.tracking-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 25px;
  bottom: 0;
  width: 2px;
  background: #e0e0e0;
}

.tracking-icon {
  font-size: 1rem;
  z-index: 1;
  background: white;
  height: fit-content;
}

.tracking-content {
  flex: 1;
}

.tracking-item.active .tracking-icon {
  color: var(--primary-color);
}


.stat-card {
  border: none;
  border-radius: 8px;
  padding: 1rem;
  color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
}

.stat-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  width: 100%;
  padding-bottom: 5px;
}

.stat-card-value {
  font-size: 2.5rem;
  font-weight: 800;
}

.stat-card-icon-circle {
  width: 40px;
  height: 40px;
  background: white;
  color: inherit;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.stat-card-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.card-header-dash {
  background: #455a64;
  color: white;
  border-radius: 12px 12px 0 0;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table thead th {
  background-color: #eceff1;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  padding: 12px 15px;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.view {
  display: none;
  width: 100%;
}

.view.active-view {
  display: block;
}

/* Badge colors per status */
.badge-status {
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.status-in-progress {
  background: #ffb74d;
  color: #000;
}

.status-urgent {
  background: #e53935;
  color: #fff;
}

.status-shipped {
  background: #4fc3f7;
  color: #000;
}

.status-completed {
  background: #43a047;
  color: #fff;
}

.status-blue {
  color: #007bff !important;
}

.status-yellow {
  color: #ffc107 !important;
}

.status-orange {
  color: #fd7e14 !important;
}

.status-green {
  color: #28a745 !important;
}

/* Supplier Manage Buttons */
.btn-manage {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-manage-edit {
  color: #3c78d8;
  background: #e8f0fe;
  border: 1px solid #c2d7f9;
}

.btn-manage-edit:hover {
  background: #d2e3fc;
  color: #1a237e;
}

.btn-manage-delete {
  color: #e06666;
  background: #fce8e8;
  border: 1px solid #f9c2c2;
}

.btn-manage-delete:hover {
  background: #fad2d2;
  color: #990000;
}

.lot-table {
  font-size: 0.75rem;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.lot-table th {
  background: #f8f9fa;
  font-weight: 600;
  padding: 4px 8px;
}

.lot-table td {
  padding: 4px 8px;
  border-top: 1px solid #eee;
}

/* Login Overlay Style - Modern Dark Theme */
#login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #030712;
  background-image: 
    radial-gradient(circle at 10% 90%, rgba(30, 58, 138, 0.2) 0%, transparent 40%),
    radial-gradient(circle at 90% 20%, rgba(30, 58, 138, 0.2) 0%, transparent 40%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-card {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  padding: 50px 40px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;
  z-index: 10;
}

.login-card h2 {
  color: #ffffff;
  font-weight: 900;
  margin-bottom: 40px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 2rem;
  line-height: 1.1;
}

.login-field-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  display: block;
}

.login-input {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 0 !important;
  color: white !important;
  padding: 10px 0 !important;
  margin-bottom: 30px;
  font-size: 0.95rem;
  width: 100%;
  transition: border-color 0.3s;
}

.login-input:focus {
  outline: none;
  border-bottom-color: #007bff !important;
  box-shadow: none !important;
}

.login-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.login-btn {
  background: linear-gradient(90deg, #007bff, #0056b3);
  border: none;
  color: white;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 123, 255, 0.3);
  background: linear-gradient(90deg, #0088ff, #0066cc);
}

/* Standard Excel Export Button */
.btn-excel {
  background-color: #107c41 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 50px !important;
  padding: 8px 22px !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 4px 6px rgba(16, 124, 65, 0.2) !important;
  font-size: 0.95rem !important;
  text-decoration: none !important;
  cursor: pointer !important;
}

.btn-excel:hover {
  background-color: #0e6a37 !important;
  color: #ffffff !important;
  box-shadow: 0 6px 15px rgba(16, 124, 65, 0.3) !important;
  transform: translateY(-2px) !important;
}

.btn-excel i {
  font-size: 1.1rem !important;
}

.bg-decoration {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 1;
}

.bg-dots {
  position: absolute;
  top: 40px;
  left: 40px;
  width: 100px;
  height: 60px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1.5px, transparent 1.5px);
  background-size: 15px 15px;
  z-index: 1;
}

@media (max-width: 992px) {
  #sidebar {
    width: 70px;
  }

  #sidebar span,
  #sidebar .sidebar-section-title,
  #sidebar small,
  #sidebar .fw-bold {
    display: none;
  }

  #content {
    margin-left: 70px;
    width: calc(100% - 70px);
  }
}
