@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --panel-sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 48%, #0f172a 100%);
  --panel-sidebar-border: rgba(148, 163, 184, 0.22);
  --panel-text-light: #cbd5e1;
  --panel-text-white: #ffffff;
  --panel-accent: #3b82f6;
  --panel-accent-deep: #2563eb;
  --panel-bg: radial-gradient(circle at 10% -10%, #e6f0ff 0%, #f7f9ff 35%, #f8fafc 78%);
  --panel-card-bg: rgba(255, 255, 255, 0.88);
  --panel-muted: #64748b;
  --panel-border: rgba(148, 163, 184, 0.22);
  --panel-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  --panel-shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
  --panel-radius: 16px;
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body.panel-theme {
  background: var(--panel-bg);
  background-attachment: fixed;
  font-family: "Manrope", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  min-height: 100vh;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.panel-theme::before {
  content: "";
  position: fixed;
  width: 360px;
  height: 360px;
  left: -120px;
  top: -130px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(59, 130, 246, 0.16), rgba(59, 130, 246, 0));
  z-index: -1;
  pointer-events: none;
}

body.panel-theme::after {
  content: "";
  position: fixed;
  width: 360px;
  height: 360px;
  right: -140px;
  bottom: -140px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(56, 189, 248, 0.14), rgba(56, 189, 248, 0));
  z-index: -1;
  pointer-events: none;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.sidebar {
  background: var(--panel-sidebar-bg);
  border-right: 1px solid var(--panel-sidebar-border);
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  transition: left 0.25s ease, box-shadow 0.25s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 12px 0 28px rgba(2, 6, 23, 0.28);
}

.sidebar .logo {
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--panel-text-white);
  text-align: center;
  padding: 20px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0));
  letter-spacing: 0.01em;
}

.sidebar-menu {
  list-style: none;
  padding: 12px 8px;
  margin: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-menu li + li {
  margin-top: 3px;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--panel-text-light);
  padding: 10px 12px;
  text-decoration: none;
  transition: all 0.22s ease;
  font-weight: 600;
  border-radius: 12px;
  position: relative;
  line-height: 1.2;
}

.sidebar-menu li a i {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.15);
  color: #e2e8f0;
  font-size: 0.86rem;
  transition: all 0.22s ease;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.95));
  color: #fff;
  transform: translateX(2px);
}

.sidebar-menu li a:hover i,
.sidebar-menu li a.active i {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.main-content {
  margin-left: 260px;
  padding: 22px;
  transition: margin-left 0.25s ease, padding 0.25s ease;
}

.top-navbar {
  background: rgba(255, 255, 255, 0.78);
  border-radius: var(--panel-radius);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 15px 18px;
  box-shadow: var(--panel-shadow-soft);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  top: 12px;
  z-index: 20;
}

.top-navbar h5 {
  margin: 0;
  font-size: 1.03rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 0.01em;
}

.top-navbar small {
  color: var(--panel-muted);
}

.mobile-toggle {
  display: none;
  background: #fff;
  border: 1px solid var(--panel-border);
  color: #334155;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.2rem;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.panel-card,
.order-card,
.chat-shell,
.well-card,
.info-card,
.api-card,
.instruction-card,
.broadcast-line,
.empty-state,
.qr-popup-card,
.state-card,
.settings-card {
  background: var(--panel-card-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow-soft);
  backdrop-filter: blur(4px);
}

.panel-card,
.order-card,
.well-card,
.info-card,
.api-card,
.settings-card {
  padding: 18px;
  margin-bottom: 16px;
}

.panel-card:hover,
.order-card:hover,
.well-card:hover,
.info-card:hover,
.api-card:hover,
.chat-shell:hover,
.broadcast-line:hover {
  transform: translateY(-2px);
  box-shadow: var(--panel-shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.panel-title {
  font-size: 1.08rem;
  font-weight: 800;
  margin-bottom: 14px;
  color: #0f172a;
}

.badge-balance {
  background: linear-gradient(90deg, #16a34a, #22c55e);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 11px;
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.25);
}

.badge-plain {
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid var(--panel-border);
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 999px;
}

/* Forms */
.form-control,
.form-select,
.custom-dd-btn,
.input-bar input {
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 12px;
  min-height: 44px;
  background: #fff;
  color: #1e293b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-control:focus,
.form-select:focus,
.custom-dd-btn:focus,
.input-bar input:focus {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
  outline: none;
}

.form-label {
  color: #475569;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.custom-dd-list {
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
}

.custom-dd-item {
  border-bottom: 1px dashed rgba(203, 213, 225, 0.65);
}

.custom-dd-item:hover {
  background: rgba(59, 130, 246, 0.08);
}

/* Buttons */
.btn,
.btn-place-order,
.btn-fund,
.send-btn,
.btn-soft,
.mode-btn,
.broadcast-line .cta {
  transition: all 0.2s ease;
}

.btn:hover,
.btn-place-order:hover,
.btn-fund:hover,
.send-btn:hover,
.btn-soft:hover,
.mode-btn:hover,
.broadcast-line .cta:hover {
  transform: translateY(-1px);
}

.btn-place-order,
.btn-fund {
  background: linear-gradient(90deg, var(--panel-accent), var(--panel-accent-deep));
  border: none;
}

.btn-place-order:hover,
.btn-fund:hover {
  filter: brightness(1.03);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.26);
}

/* Tabs / filters / chips */
.mode-tabs,
.filter-scroll {
  background: rgba(248, 250, 252, 0.72);
  border: 1px solid rgba(203, 213, 225, 0.55);
  border-radius: 12px;
  padding: 6px;
}

.mode-btn,
.filter-btn,
.chip {
  border: 1px solid rgba(203, 213, 225, 0.55);
  background: #fff;
  color: #475569;
}

.mode-btn.active,
.filter-btn.active {
  background: linear-gradient(90deg, var(--panel-accent), var(--panel-accent-deep));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.25);
}

/* Tables */
.table {
  --bs-table-bg: transparent;
  color: #334155;
}

.table thead th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  background: rgba(241, 245, 249, 0.9);
  border-bottom: 1px solid rgba(203, 213, 225, 0.65);
}

.table > :not(caption) > * > * {
  padding: 0.72rem;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background: rgba(248, 250, 252, 0.62);
}

/* Utility */
.text-muted {
  color: #64748b !important;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* Loaders / popups */
.page-loader-card {
  border: 1px solid rgba(203, 213, 225, 0.55);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(8px);
}

/* Entrance animation */
.panel-card,
.order-card,
.chat-shell,
.well-card,
.info-card,
.api-card,
.broadcast-line,
.empty-state {
  animation: panelFadeUp 0.34s ease;
}

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

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

::-webkit-scrollbar-track {
  background: rgba(226, 232, 240, 0.65);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.72), rgba(37, 99, 235, 0.72));
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.88), rgba(37, 99, 235, 0.88));
}

@media (max-width: 992px) {
  .sidebar {
    left: -260px;
    box-shadow: none;
  }

  .sidebar.show {
    left: 0;
    box-shadow: 12px 0 32px rgba(2, 6, 23, 0.35);
  }

  .main-content {
    margin-left: 0;
    padding: 14px;
  }

  .mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .overlay.show {
    display: block;
  }

  .top-navbar {
    top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
