:root {
  --bg-dark: #07040d;
  --bg-sidebar: #0f0b1a;
  --bg-card: rgba(22, 17, 34, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --primary: #8a2be2;
  --primary-glow: rgba(138, 43, 226, 0.4);
  --secondary: #00f2fe;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --text-main: #f3effa;
  --text-muted: #9c91b5;
  --card-radius: 16px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(138, 43, 226, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 242, 254, 0.12) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Layout Wrapper */
.app-layout,
.dashboard-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 1.3rem;
  margin-bottom: 3rem;
}

.logo-badge {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.sidebar ul,
.sidebar ol,
.sidebar li,
.sidebar-menu,
.sidebar-menu li,
.menu-list,
.menu-list li {
  list-style: none !important;
  list-style-type: none !important;
  margin: 0;
  padding: 0;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.menu-item {
  padding: 0.9rem 1.2rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.menu-item:hover, .menu-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.menu-item.active {
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.15) 0%, rgba(0, 242, 254, 0.15) 100%);
  border-left: 4px solid var(--secondary);
  padding-left: calc(1.2rem - 4px);
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Main Content */
.main-content {
  flex-grow: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: calc(100% - 280px);
}

header {
  background: rgba(13, 9, 24, 0.85);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border-color);
  padding: 1.2rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 5;
}

.mobile-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 12;
  margin-right: 12px;
}

.mobile-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: var(--primary);
}

.header-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.container {
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

/* Pages/Tabs Sections */
.tab-section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-section.active {
  display: block;
}

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

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 2rem;
  backdrop-filter: blur(20px);
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title i {
  color: var(--secondary);
}

/* Buttons */
.btn {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #b5179e);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(138, 43, 226, 0.6);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: translateY(-2px);
}

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

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.8rem;
  display: flex;
  align-items: center;
  gap: 20px;
  backdrop-filter: blur(20px);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: rgba(138, 43, 226, 0.1);
  border: 1px solid rgba(138, 43, 226, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #dfb2ff;
}

.stat-box.cyan .stat-icon {
  background: rgba(0, 242, 254, 0.1);
  border-color: rgba(0, 242, 254, 0.2);
  color: var(--secondary);
}

.stat-box.green .stat-icon {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: #fff;
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

select.form-control option,
select option {
  background-color: #161226 !important;
  color: #f3effa !important;
  padding: 10px 14px;
}

select option:hover,
select option:focus,
select option:checked {
  background-color: #3b82f6 !important;
  color: #ffffff !important;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
}

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

th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 600;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

td {
  padding: 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-secondary { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); border: 1px solid var(--border-color); }

.code-text {
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--secondary);
}

/* Terminal Console */
.terminal-container {
  background: #0d0818;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.terminal-header {
  background: rgba(255, 255, 255, 0.04);
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.terminal-controls {
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
}
.terminal-dot.yellow { background: #eab308; }
.terminal-dot.green { background: #22c55e; }

.terminal-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Fira Code', monospace;
}

.terminal-body {
  padding: 1.5rem;
  height: 400px;
  overflow-y: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  color: #dfb2ff;
  line-height: 1.6;
}

.log-line {
  margin-bottom: 0.5rem;
  display: flex;
  gap: 10px;
}

.log-time { color: var(--text-muted); }
.log-tag { color: var(--secondary); font-weight: 600; }
.log-message { color: var(--text-main); }

.alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-top: 1rem;
  display: none;
}

.alert-success { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); color: #34d399; }
.alert-error { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: #f87171; }

/* Pagination controls */
.pagination-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

/* Mobile Toggle Button */
.mobile-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Sidebar overlay backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9;
  pointer-events: none;
}

/* Range add subform grid */
.range-add-grid {
  display: grid;
  grid-template-columns: 140px 100px 100px 1fr 1fr 100px 110px 100px;
  gap: 12px;
  align-items: flex-end;
}

/* Supplier add inline card grid */
.supplier-add-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) 120px;
  gap: 15px;
  align-items: flex-end;
}

/* Media Queries for Responsive Desktop, Laptop, Tablet, and Mobile Layouts */
@media (max-width: 992px) {
  .mobile-toggle-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    cursor: pointer;
    z-index: 10001 !important;
    pointer-events: auto !important;
  }

  aside.sidebar,
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    transform: translateX(-100%) !important;
    width: 280px !important;
    height: 100vh !important;
    z-index: 9999 !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.85) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    background-color: #0f0a1c !important;
  }

  aside.sidebar.active,
  aside.sidebar.open,
  .sidebar.active,
  .sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-overlay {
    display: none;
    pointer-events: none;
  }

  .sidebar-overlay.active,
  .sidebar-overlay.show,
  .sidebar-overlay.open {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(6px) !important;
    z-index: 9998 !important;
    pointer-events: auto !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  header {
    padding: 1rem 1.25rem;
  }

  .container {
    padding: 1.25rem 1rem;
    gap: 1.2rem;
  }

  .card {
    padding: 1.25rem;
  }

  .range-add-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .range-add-grid {
    grid-template-columns: 1fr;
  }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }
}

@media (max-width: 576px) {
  header {
    padding: 0.8rem 1rem;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .header-actions .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .title-area h1 {
    font-size: 1.5rem;
  }

  .title-area p {
    font-size: 0.85rem;
  }

  .card {
    padding: 1rem;
  }

  .stat-box {
    padding: 1rem;
    gap: 10px;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .form-control {
    width: 100% !important;
    max-width: 100% !important;
  }

  .supplier-add-grid {
    grid-template-columns: 1fr;
  }
}

/* Anchor override for list items */
a.menu-item {
  text-decoration: none;
  color: var(--text-muted);
}
a.menu-item:hover {
  text-decoration: none;
  color: #fff;
}

/* Actions Dropdown Menu Styling */
.actions-dropdown-container {
  position: relative;
  display: inline-block;
}

.actions-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
  border-radius: 6px !important;
  padding: 0.35rem 0.75rem !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.actions-btn:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.actions-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #181b2a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(138, 43, 226, 0.2);
  min-width: 210px;
  z-index: 999999;
  text-align: left;
  padding: 5px 0;
  backdrop-filter: blur(20px);
}

.actions-dropdown-menu.show {
  display: block !important;
}

.actions-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: #e2e8f0;
  font-size: 0.83rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.actions-dropdown-menu a:hover {
  background: rgba(138, 43, 226, 0.25);
  color: #fff;
}

.actions-dropdown-menu i {
  width: 16px;
  text-align: center;
  color: var(--secondary);
  font-size: 0.85rem;
}

.actions-submenu-group {
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}

.actions-submenu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  color: #e2e8f0;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.actions-submenu-title:hover {
  background: rgba(138, 43, 226, 0.25);
  color: #fff;
}

.actions-submenu-items {
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 0;
  border-left: 2px solid var(--primary);
  margin: 2px 10px 4px 14px;
}

.actions-submenu-items a {
  padding: 6px 12px;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.actions-submenu-items a:hover {
  color: var(--secondary);
  background: rgba(255, 255, 255, 0.05);
}

/* Glassmorphic Modal Dialog Styling */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  pointer-events: auto !important;
}

.modal-overlay.active,
.modal-overlay.show,
.modal-overlay.open {
  display: flex !important;
  pointer-events: auto !important;
}

.modal-card {
  background: rgba(24, 28, 45, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 40px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 22px;
  color: #e2e8f0;
  font-size: 0.9rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Universal Sidebar Toggle Button & Collapsible Desktop Support */
.mobile-toggle-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mobile-toggle-btn:hover {
  background: rgba(138, 43, 226, 0.35);
  border-color: var(--secondary);
}

@media (min-width: 992px) {
  .app-layout.sidebar-collapsed .sidebar {
    transform: translateX(-100%) !important;
  }
  .app-layout.sidebar-collapsed .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

