@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap');

:root {
  /* Color Palette */
  --bg-base: #0a0e1a;
  --bg-gradient-1: #0d1326;
  --bg-gradient-2: #161129;
  
  --glass-bg: rgba(16, 22, 42, 0.4);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.15);
  
  --accent-blue: #3b82f6;
  --accent-blue-hover: #60a5fa;
  --accent-green: #10b981;
  --accent-green-hover: #34d399;
  --accent-purple: #8b5cf6;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.5);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.5);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-primary);
  background: var(--bg-base);
  overflow: hidden;
  user-select: none;
  position: relative;
}

/* Animated Gradient Background */
body::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.15), transparent 30%),
              radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.12), transparent 30%),
              radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.08), transparent 40%);
  animation: bgPulse 20s ease-in-out infinite alternate;
  z-index: -1;
}

@keyframes bgPulse {
  0% { transform: scale(1) translate(0, 0); }
  50% { transform: scale(1.1) translate(-2%, 2%); }
  100% { transform: scale(1) translate(2%, -2%); }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Layout Container */
.app-container {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
  background: transparent;
}

/* Sidebar */
.sidebar {
  width: 260px;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  padding: 24px 0;
  transition: width var(--transition-normal);
  z-index: 10;
}

.brand-header {
  display: flex;
  align-items: center;
  padding: 0 24px;
  margin-bottom: 40px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  margin-right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  position: relative;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
  animation: logoPulse 4s infinite alternate;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.brand-logo::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple), var(--accent-green));
  z-index: -1;
  opacity: 0;
  animation: logoRotate 6s linear infinite;
  transition: opacity var(--transition-normal);
}

.brand-header:hover .brand-logo::after {
  opacity: 0.6;
}

@keyframes logoPulse {
  0% { box-shadow: 0 0 10px rgba(139, 92, 246, 0.3); }
  100% { box-shadow: 0 0 25px rgba(59, 130, 246, 0.6); }
}

@keyframes logoRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 4px;
  height: 60%;
  background: var(--accent-blue);
  border-radius: 0 4px 4px 0;
  transition: transform var(--transition-normal);
  box-shadow: 0 0 10px var(--accent-blue);
}

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

.nav-item.active {
  color: var(--text-primary);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, transparent 100%);
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

/* Main Content Area */
.main-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Top Bar */
.top-bar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: linear-gradient(180deg, rgba(10, 14, 26, 0.8) 0%, rgba(10, 14, 26, 0) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.view-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.status-pills {
  display: flex;
  gap: 12px;
}

.pill {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.pill::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: #64748b;
}

.pill.green {
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
}
.pill.green::before {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulseGreen 2s infinite;
}

.pill.blue {
  color: var(--accent-blue);
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.1);
}
.pill.blue::before {
  background: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue);
  animation: pulseBlue 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseBlue {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Workspace (Scrollable content) */
.workspace {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 64px);
  padding: 32px;
  overflow-y: auto !important;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Banner */
.banner {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.banner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  opacity: 0.5;
  pointer-events: none;
  animation: rotateGlow 10s linear infinite;
}

.banner-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(to right, #fff, var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.banner-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Stats Grid & Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.05), transparent);
  transform: skewX(-20deg);
  transition: all 0.5s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(59, 130, 246, 0.1);
}

.card:hover::after {
  left: 200%;
}

.card-title {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.card-value.green {
  color: var(--accent-green);
  text-shadow: var(--shadow-glow-green);
}

.card-value.blue {
  color: var(--accent-blue);
  text-shadow: var(--shadow-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, var(--accent-blue));
  color: #fff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-success {
  background: linear-gradient(135deg, #059669, var(--accent-green));
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #ef4444, #f87171);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Tables */
.table-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px 24px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

td {
  padding: 16px 24px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: all var(--transition-fast);
}

tr:last-child td {
  border-bottom: none;
}

tr {
  transition: background var(--transition-fast);
}

tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

tr:hover td {
  background: rgba(59, 130, 246, 0.05);
  color: var(--text-primary);
}
tr:hover {
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all var(--transition-normal);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: rgba(0, 0, 0, 0.3);
}

/* Modern UI Toggle Switch & Setting Rows */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.setting-row:last-child {
  border-bottom: none;
}
.setting-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.setting-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.setting-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Log Drawer */
.log-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 280px;
  background: rgba(8, 12, 22, 0.97);
  border-top: 1px solid rgba(16, 185, 129, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  z-index: 20;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(232px);
}

.log-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  cursor: pointer;
  background: rgba(16, 185, 129, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-header:hover {
  background: rgba(16, 185, 129, 0.1);
}

.drawer-title {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title::before {
  content: '>';
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.log-body {
  flex: 1;
  padding: 16px 24px;
  overflow-y: auto;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #a7f3d0;
  background: rgba(0, 0, 0, 0.3);
}

.log-body div {
  padding-left: 12px;
  border-left: 2px solid rgba(16, 185, 129, 0.3);
  margin-bottom: 4px;
  opacity: 0.9;
}
.log-body div:hover {
  border-left-color: var(--accent-green);
  opacity: 1;
  background: rgba(16, 185, 129, 0.05);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  background: linear-gradient(145deg, #131927, #0d1326);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.3s ease;
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
}

.modal-card h2 {
  font-size: 20px;
  font-weight: 700;
}

@keyframes modalIn {
  from { transform: scale(0.92) translateY(16px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* Progress bar shimmer */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  border-radius: 4px;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Utility: action bar button row */
.btn + .btn { margin-left: 0; }

/* Banner layout fix */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Sidebar footer text */
.sidebar > div:last-child {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--glass-border);
  padding-top: 16px;
  margin-top: auto;
}

/* GiftUp settings card adjustments */
#giftupSettingsCard {
  border-color: rgba(245, 158, 11, 0.3) !important;
  background: rgba(245, 158, 11, 0.04) !important;
}

/* Card inline row layout override */
.card[style*="flex-direction: row"] {
  flex-direction: row !important;
}

/* Gap variable for consistent spacing */
.form-group + .form-group {
  margin-top: 0;
}

/* Inspection progress bar */
#inspectProgressBarFill {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple)) !important;
  position: relative;
}

#inspectProgressBarFill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.4) 50%,
    rgba(255,255,255,0) 100%
  );
  transform: translateX(-100%);
  animation: shimmer 2s infinite;
}

/* Responsive helper */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Code elements */
code {
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-blue);
}

/* Selection highlight */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: white;
}

