:root {
  --primary-color: #0ea5e9;
  --secondary-color: #38bdf8;
  --accent-color: #f97316;
  --danger-color: #ef4444;
  --dark-bg: #0b1324;
  --sidebar-bg: #1f2937;
  --text-light: #f3f4f6;
  --text-muted: #9ca3af;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --transition-speed: 0.3s;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #0b0b0f;
  background:
    radial-gradient(900px 450px at 20% 15%, rgba(255, 99, 71, 0.28), transparent 60%),
    radial-gradient(850px 420px at 85% 20%, rgba(249, 115, 22, 0.22), transparent 58%),
    radial-gradient(1000px 520px at 50% 92%, rgba(239, 68, 68, 0.20), transparent 62%),
    linear-gradient(180deg, #050509 0%, #0b0b0f 55%, #111827 100%);
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 6px;
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #555;
}

/* Sidebar */
.sidebar {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--dark-bg) 0%, #172036 60%, var(--sidebar-bg) 100%);
  color: #fff;
  position: relative;
  z-index: 2000;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-speed) ease;
}

.sidebar .dropdown-menu {
  margin-top: .25rem;
  display: none;
  background-color: #2d3748;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .dropdown-menu.show { display: block; }
.sidebar .nav-item.dropdown.dropstart { position: relative; }

.sidebar .nav-item.dropdown.dropstart .dropdown-menu {
  top: 0;
  right: calc(100% - .25rem);
  left: auto;
  margin-right: .5rem;
  z-index: 3000;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  padding: .5rem 0.75rem;
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.75);
  padding: 0.75rem 1.25rem;
  margin: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  transition: all var(--transition-speed);
  display: flex;
  align-items: center;
}

.sidebar .nav-link:hover {
  color: #fff;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.25) 0%, rgba(249, 115, 22, 0.25) 100%);
  transform: translateX(-4px);
}

.sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
  box-shadow: 0 0 0.5rem rgba(14, 165, 233, 0.4);
}

.sidebar .nav-link i {
  margin-left: 0.75rem;
  width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  padding: 2rem;
  transition: all var(--transition-speed);
}

/* Brand */
.brand-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-icon {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 5px rgba(14, 165, 233, 0.5));
}

.brand-title {
  font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Page Header */
.page-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-header h1, .page-header h2, .page-header h3 {
  color: #1e293b;
  font-weight: 700;
}

/* Cards */
.card {
  margin-bottom: 1.5rem;
  border: none;
  border-radius: 1rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  background: #fff;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-header {
  background: linear-gradient(90deg, rgba(14,165,233,.12) 0%, rgba(249,115,22,.12) 100%);
  border-bottom: 1px solid rgba(2,6,23,.08);
  font-weight: 600;
  padding: 1rem 1.5rem;
}

/* Quick Actions */
.quick-actions .btn {
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: all 0.2s;
  margin: 0.25rem;
  border-radius: 0.5rem;
}

.quick-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.5rem;
}

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

@media (min-width: 992px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1200px) {
  .stats-grid.stats-grid-5 { grid-template-columns: repeat(5, 1fr); }
}

.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--card-shadow);
  background: #fff;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: scale(1.02);
}

.stat-card .meta {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.stat-card .meta h6 {
  margin: 0;
  font-weight: 600;
  color: #64748b;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.stat-card .icon {
  width: 56px;
  height: 56px;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Stat Variants */
.stat-primary { background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%); border-left: 4px solid var(--primary-color); }
.stat-primary .value { color: var(--primary-color); }
.stat-primary .icon { background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); }

.stat-success { background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%); border-left: 4px solid #10b981; }
.stat-success .value { color: #10b981; }
.stat-success .icon { background: linear-gradient(135deg, #10b981, #34d399); }

.stat-warning { background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%); border-left: 4px solid #f59e0b; }
.stat-warning .value { color: #f59e0b; }
.stat-warning .icon { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

.stat-danger { background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%); border-left: 4px solid var(--danger-color); }
.stat-danger .value { color: var(--danger-color); }
.stat-danger .icon { background: linear-gradient(135deg, var(--danger-color), #f87171); }

/* Buttons & Elements */
.badge {
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  padding: 0.5em 0.8em;
  font-weight: 600;
}

.list-group-item-action {
  border: 1px solid rgba(2,6,23,.06);
  margin-bottom: 0.25rem;
  border-radius: 0.5rem !important;
}

.list-group-item-action:hover {
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  background-color: #f8fafc;
  z-index: 1;
}

/* Button Overrides */
.btn-primary {
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border: none;
}
.btn-primary:hover {
  background: linear-gradient(90deg, #0891b2, #0ea5e9);
}

.btn-danger {
  background: linear-gradient(90deg, var(--accent-color), var(--danger-color));
  border: none;
}
.btn-danger:hover {
  background: linear-gradient(90deg, #ea580c, #dc2626);
}

.btn-outline-warning {
  color: var(--accent-color);
  border-color: var(--accent-color);
}
.btn-outline-warning:hover {
  color: #111827;
  background: var(--accent-color);
  border-color: var(--accent-color);
}

.badge.bg-warning.text-dark {
  background: linear-gradient(90deg, #fde68a, #fca5a5);
  color: #111827;
}

/* Navbar & Dropdowns */
.dropdown-menu {
  text-align: right;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.tooltip,
.tooltip * {
  pointer-events: none;
}

.navbar .dropdown-brand {
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.10) 0%, rgba(249, 115, 22, 0.10) 100%), #0b1324;
  border-radius: 0.5rem;
  box-shadow: 0 0.375rem 1rem rgba(2, 6, 23, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.navbar .dropdown-brand .dropdown-header {
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.navbar .dropdown-brand .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e2e8f0;
}

.navbar .dropdown-brand .dropdown-item:hover {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.18) 0%, rgba(249, 115, 22, 0.18) 100%);
  color: #fff;
}

.navbar .dropdown-brand .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.08);
}

/* App Frame */
.app-frame {
  border: 1px solid rgba(2, 6, 23, 0.08);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
  box-shadow: 0 0.75rem 2rem rgba(2, 6, 23, 0.10);
  overflow: hidden;
  height: 100%;
}

.app-frame-maximized {
  border-radius: 0;
  margin: 0 !important;
  box-shadow: none;
}

.app-frame-fullscreen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw; height: 100vh;
  margin: 0 !important; border-radius: 0; box-shadow: none;
  z-index: 3500;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

body.app-frame-fullscreen-active { overflow: hidden; }
body.app-frame-fullscreen-active nav.navbar { display: none !important; }

.app-frame-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.12) 0%, rgba(249, 115, 22, 0.12) 100%);
  border-bottom: 1px solid rgba(2, 6, 23, 0.06);
}

.app-frame-topbar .title {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  color: #0f172a;
}

.app-frame-topbar .title span {
  line-height: 1.2;
}

.app-frame-controls {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.app-frame-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .75rem;
  border: 1px solid rgba(2, 6, 23, 0.10);
  background: rgba(255, 255, 255, 0.65);
  color: #334155;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease, border-color .12s ease, color .12s ease;
}

.app-frame-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0.35rem 1rem rgba(2, 6, 23, 0.18);
  transform: translateY(-1px);
}

.app-frame-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.app-frame-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 .2rem rgba(14, 165, 233, 0.25);
}

.app-frame-btn-minimize:hover {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.30);
  color: var(--primary-color);
}

.app-frame-btn-maximize:hover {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.30);
  color: var(--accent-color);
}

.app-frame-btn-close:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.30);
  color: var(--danger-color);
}

.app-frame-btn i {
  font-size: 0.95rem;
}

.app-taskbar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 3600;
  padding: .5rem .75rem;
  border-radius: 999px;
  border: 1px solid rgba(2, 6, 23, 0.10);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0.75rem 2rem rgba(2, 6, 23, 0.18);
  max-width: min(92vw, 1100px);
}

.app-taskbar-list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.app-taskbar-list .btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.app-taskbar-list .btn.btn-primary {
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(14, 165, 233, 0.25);
  color: #0f172a;
}

.app-taskbar-list .btn.btn-primary:hover {
  background: rgba(14, 165, 233, 0.22);
  border-color: rgba(14, 165, 233, 0.35);
}

.modal-content {
  border: 1px solid rgba(2, 6, 23, 0.10);
  border-radius: 1rem;
  box-shadow: 0 1rem 3rem rgba(2, 6, 23, 0.25);
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.12) 0%, rgba(249, 115, 22, 0.12) 100%);
  border-bottom: 1px solid rgba(2, 6, 23, 0.06);
}

.modal-footer {
  background: rgba(248, 250, 252, 0.85);
  border-top: 1px solid rgba(2, 6, 23, 0.06);
}

.modal-backdrop.show {
  opacity: 0.6;
}

.btn-press {
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.btn-press:active {
  transform: scale(0.98);
  box-shadow: 0 0.5rem 1.25rem rgba(2, 6, 23, 0.18);
  filter: brightness(0.98);
}

.delete-confirm-modal .modal-header {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.12) 0%, rgba(249, 115, 22, 0.10) 100%);
}

.delete-confirm-modal .modal-title {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.delete-confirm-wrap {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.delete-confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger-color);
  flex: 0 0 auto;
}

@media (max-width: 575.98px) {
  .delete-confirm-wrap {
    flex-direction: column;
  }

  .delete-confirm-icon {
    align-self: center;
  }
}

.delete-confirm-details {
  background: rgba(2, 6, 23, 0.03);
  border: 1px solid rgba(2, 6, 23, 0.08);
  border-radius: 0.9rem;
  padding: .75rem .9rem;
}

.delete-detail-label {
  font-size: .8rem;
  color: #64748b;
}

/* Unified Search Box Styles (Pill Shape like Customers) */
.search-box {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.search-box .form-control {
    padding-right: 2.5rem !important;
    padding-left: 2.5rem !important;
    border-radius: 2rem;
    background-color: #f8f9fc;
    border: 1px solid #d1d3e2;
    height: 38px; /* Ensure consistent height */
}

.search-box .search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #d1d3e2;
    pointer-events: none;
    z-index: 4;
}

.search-box .clear-btn {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #e74a3b;
    cursor: pointer;
    text-decoration: none;
    z-index: 5;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
}

.search-box .clear-btn:hover {
    color: #be2617;
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 9999;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
}

.scroll-to-top.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
}

.delete-detail-value {
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

/* Charts */
.chart-card {
  border: none;
  box-shadow: var(--card-shadow);
  border-radius: 1rem;
  background: #fff;
}
.chart-card .card-body { height: 360px; }

/* Login Page */
.login-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.branding-section {
  flex: 1;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  overflow: hidden;
  display: none;
}

@media (min-width: 992px) {
  .branding-section { display: flex; }
}

.branding-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.2) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(249, 115, 22, 0.2) 0%, transparent 40%);
  z-index: 1;
}

.branding-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
}

.branding-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 2rem;
  filter: drop-shadow(0 0 20px rgba(14, 165, 233, 0.5));
}

.branding-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(to right, #38bdf8, #f97316);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.branding-subtitle {
  font-size: 1.2rem;
  color: #94a3b8;
  max-width: 400px;
  line-height: 1.6;
}

.form-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: white;
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
}

.mobile-logo {
  display: block;
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem;
}

@media (min-width: 992px) {
  .mobile-logo { display: none; }
}

.welcome-text {
  text-align: center;
  margin-bottom: 2.5rem;
}

.welcome-text h2 {
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.welcome-text p { color: #64748b; }

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  color: var(--primary-color);
  transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.login-btn {
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  border: none;
  padding: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
  transition: all 0.3s ease;
  color: white;
  width: 100%;
}

.login-btn:hover {
  background: linear-gradient(90deg, #0284c7, #0ea5e9);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
  color: white;
}

.copyright {
  position: absolute;
  bottom: 1.5rem;
  left: 0;
  right: 0;
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
}

.shape {
  position: absolute;
  opacity: 0.1;
  z-index: 0;
}
.shape-1 {
  top: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--primary-color);
  filter: blur(60px);
}
.shape-2 {
  bottom: -50px;
  left: -50px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--secondary-color);
  filter: blur(80px);
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 9999;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
}

.scroll-to-top.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
}
