/* Design System & Premium Styles */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Light Theme variables (default) - Premium, vibrant, and sleek */
  --bg-color: #f8fafc;
  --bg-gradient: radial-gradient(circle at top right, rgba(99, 102, 241, 0.08), transparent 45%),
                 radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.06), transparent 45%),
                 linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%);
  --panel-bg: rgba(255, 255, 255, 0.82);
  --panel-border: rgba(0, 0, 0, 0.06);
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-hover-bg: rgba(255, 255, 255, 0.98);
  --card-hover-border: rgba(99, 102, 241, 0.35);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-color: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  --accent-light: rgba(79, 70, 229, 0.1);
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  --glass-blur: blur(16px);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 20px;
  --blob-opacity: 0.12;
}

[data-theme="dark"] {
  /* Dark Theme - High contrast, rich aesthetics */
  --bg-color: #0b0c10;
  --bg-gradient: radial-gradient(circle at top right, rgba(99, 102, 241, 0.08), transparent 40%),
                 radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.08), transparent 40%);
  --panel-bg: rgba(22, 25, 39, 0.7);
  --panel-border: rgba(255, 255, 255, 0.07);
  --card-bg: rgba(26, 29, 46, 0.6);
  --card-hover-bg: rgba(35, 39, 61, 0.8);
  --card-hover-border: rgba(99, 102, 241, 0.4);
  --text-primary: #f4f4f7;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-color: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
  --accent-light: rgba(99, 102, 241, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 30px -10px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, 0.8);
  --blob-opacity: 0.05;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Focus styles for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.tool-card:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 4px;
  border-color: var(--accent-color);
}

.btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-light);
}

.nav-link:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Main Container Layout */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
  position: relative;
}

/* Sidebar navigation */
.sidebar {
  width: 280px;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition);
}

.brand-section {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--panel-border);
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-container {
  padding: 20px 24px 10px 24px;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.search-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: var(--border-radius-sm);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.nav-section {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.nav-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 8px;
  padding-left: 12px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  width: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-link:hover {
  background: var(--card-hover-bg);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent-color);
  border-color: rgba(99, 102, 241, 0.15);
  font-weight: 600;
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle-btn {
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  transform: rotate(15deg);
}

/* Main Content Workspace */
.main-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 40px;
  overflow-y: auto;
}

/* Navbar top style */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
}

.breadcrumb-area {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.breadcrumb-root {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--text-muted);
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--success);
  background: var(--success-bg);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 500;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success), 0 0 16px rgba(16, 185, 129, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Dashboard Home Grid */
.dashboard-home {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.hero-banner {
  padding: 48px 40px;
  border-radius: var(--border-radius-lg);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -60px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--accent-gradient);
  filter: blur(90px);
  opacity: 0.12;
  z-index: 0;
  animation: heroGlow 8s ease-in-out infinite alternate;
}

.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: 20%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(99, 102, 241, 0.08));
  filter: blur(70px);
  z-index: 0;
  animation: heroGlow 10s ease-in-out 2s infinite alternate;
}

@keyframes heroGlow {
  0% { transform: translate(0, 0) scale(1); opacity: 0.1; }
  100% { transform: translate(10px, -10px) scale(1.1); opacity: 0.18; }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero-title span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Category Sections */
.tool-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Tool Cards */
.tool-card {
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  padding: 24px;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--border-radius-md);
  padding: 1px;
  background: linear-gradient(135deg, transparent 0%, rgba(99, 102, 241, 0) 50%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.tool-card:hover {
  background: var(--card-hover-bg);
  border-color: var(--card-hover-border);
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-lg);
}

.tool-card:hover::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4) 0%, rgba(168, 85, 247, 0.4) 100%);
}

.tool-card:active {
  transform: translateY(-2px) scale(0.995);
  transition-duration: 0.1s;
}

.tool-icon-wrapper {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 1.4rem;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tool-icon-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 0;
}

.tool-icon-wrapper i, .tool-icon-wrapper svg {
  position: relative;
  z-index: 1;
}

.tool-card:hover .tool-icon-wrapper {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  transform: scale(1.08);
}

.tool-card:hover .tool-icon-wrapper::after {
  opacity: 1;
}

.tool-card:hover .tool-icon-wrapper i,
.tool-card:hover .tool-icon-wrapper svg {
  color: #fff;
}

.tool-card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.tool-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tool-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.tool-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  text-transform: uppercase;
}

.tool-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: var(--transition);
}

.tool-card:hover .tool-arrow {
  color: var(--accent-color);
  transform: translateX(4px);
}

/* Tool View Workspace */
.tool-view-workspace {
  display: none; /* Controlled by JS switcher */
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.4s ease;
}

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

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-back:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: var(--card-hover-bg);
}

.workspace-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workspace-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.workspace-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Common Workspace Components */
.tool-layout-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.tool-layout-single {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (max-width: 1024px) {
  .tool-layout-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: box-shadow 0.3s ease;
}

.panel:hover {
  box-shadow: var(--shadow-lg);
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* File Upload Area */
.upload-zone {
  border: 2px dashed var(--panel-border);
  border-radius: var(--border-radius-md);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 0;
}

.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--accent-color);
  background: rgba(99, 102, 241, 0.04);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px var(--accent-light);
}

.upload-zone:hover::before, .upload-zone.dragging::before {
  opacity: 0.03;
}

.upload-zone:hover .upload-icon, .upload-zone.dragging .upload-icon {
  color: var(--accent-color);
  transform: translateY(-6px) scale(1.1);
}

.upload-icon {
  font-size: 2.25rem;
  color: var(--text-muted);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}

.upload-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-subtext {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.file-input {
  display: none;
}

/* Options / Configuration Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Button variants */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-gradient-hover);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--card-hover-bg);
  border-color: var(--text-muted);
}

/* Grid layout for configuration items */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

/* File list panel styling */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  font-size: 0.88rem;
  animation: slideIn 0.2s ease;
}

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

.file-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.file-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.file-item-size {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.file-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-item-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

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

.file-item-btn.remove:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* Image Tool Previews */
.preview-container {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 200px;
  background: rgba(0,0,0,0.15);
  border-radius: var(--border-radius-sm);
  padding: 20px;
  position: relative;
}

.preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 250px;
}

.preview-img-wrapper {
  width: 100%;
  height: 180px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(rgba(0,0,0,0.1) 0% 25%, rgba(255,255,255,0.05) 0% 50%) 50% / 16px 16px;
}

.preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
}

/* JSON Editor Styling */
.json-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  min-height: 480px;
}

@media (max-width: 768px) {
  .json-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

.json-textarea {
  width: 100%;
  height: 400px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  font-family: monospace;
  font-size: 0.9rem;
  resize: vertical;
  line-height: 1.5;
}

.json-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.json-output {
  height: 400px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  overflow: auto;
  font-family: monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

.json-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.json-error-msg {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  font-size: 0.88rem;
  border-left: 4px solid var(--danger);
  display: none;
}

/* QR Code Tool Custom Stylings */
.qr-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--panel-border);
  min-height: 250px;
}

#qrcode-canvas-wrapper {
  padding: 16px;
  background: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

#qrcode-canvas-wrapper canvas, #qrcode-canvas-wrapper img {
  max-width: 100%;
  height: auto !important;
}

.scanner-video-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid var(--panel-border);
  display: none;
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scanner-laser {
  position: absolute;
  width: 80%;
  height: 2px;
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
  animation: laserScan 2.5s linear infinite;
}

@keyframes laserScan {
  0% { top: 15%; }
  50% { top: 85%; }
  100% { top: 15%; }
}

/* Text Base64 styling */
.text-area-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

/* Floating Blob Decoration */
.glowing-blob {
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: var(--accent-gradient);
  filter: blur(100px);
  opacity: var(--blob-opacity);
  pointer-events: none;
  z-index: 0;
  animation: blobFloat 20s ease-in-out infinite alternate;
}

.blob-1 { top: 10%; left: 20%; animation-delay: 0s; }
.blob-2 { bottom: 10%; right: 10%; animation-delay: -10s; }

@keyframes blobFloat {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
  100% { transform: translate(10px, -10px) scale(1.02); }
}

/* Mobile navbar adjustments */
.menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

@media (max-width: 768px) {
  .menu-btn {
    display: block;
  }
  
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
  }
  
  .sidebar.open {
    left: 0;
    box-shadow: var(--shadow-lg);
  }
  
  .main-workspace {
    padding: 20px 24px;
  }
  
  .app-container.sidebar-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
  }
}

/* Custom tabs for tool subsections */
.tab-group {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  font-size: 0.9rem;
}

.tab-btn:hover {
  background: var(--card-hover-bg);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent-light);
  color: var(--accent-color);
  font-weight: 600;
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.2s ease;
}

.tab-content.active {
  display: flex;
}

/* ==========================================
   TOAST NOTIFICATION SYSTEM
   ========================================== */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--border-radius-sm);
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: all;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-exit {
  transform: translateX(120%);
  opacity: 0;
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
  line-height: 1;
}

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

.toast-success .toast-icon { color: var(--success); background: var(--success-bg); }
.toast-error .toast-icon { color: var(--danger); background: var(--danger-bg); }
.toast-warning .toast-icon { color: var(--warning); background: var(--warning-bg); }
.toast-info .toast-icon { color: var(--accent-color); background: var(--accent-light); }

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--accent-color); }

@media (max-width: 480px) {
  #toast-container {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

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

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 0%;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ==========================================
   COMPRESSION RESULT CARD
   ========================================== */
.result-card {
  display: none;
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--border-radius-sm);
  padding: 16px 20px;
  animation: fadeIn 0.4s ease;
}

.result-card.visible {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--success);
}

.result-card-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.result-card-stats strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ==========================================
   RESET/UPLOAD ANOTHER BUTTON
   ========================================== */
.btn-reset {
  display: none;
  background: transparent;
  border: 1px dashed var(--panel-border);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
  text-align: center;
  width: 100%;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.btn-reset.visible {
  display: inline-flex;
}

.btn-reset:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: var(--accent-light);
}

/* ==========================================
   FOOTER
   ========================================== */
.main-footer {
  margin-top: auto;
  padding: 24px 0 8px 0;
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* ==========================================
   CARD SHIMMER ON LOAD
   ========================================== */
.tool-card {
  animation: cardEnter 0.5s ease backwards;
}

.tool-card:nth-child(1) { animation-delay: 0.05s; }
.tool-card:nth-child(2) { animation-delay: 0.1s; }
.tool-card:nth-child(3) { animation-delay: 0.15s; }
.tool-card:nth-child(4) { animation-delay: 0.2s; }
.tool-card:nth-child(5) { animation-delay: 0.25s; }
.tool-card:nth-child(6) { animation-delay: 0.3s; }
.tool-card:nth-child(7) { animation-delay: 0.35s; }
.tool-card:nth-child(8) { animation-delay: 0.4s; }

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

/* ==========================================
   SPIN ANIMATION (for loader icons)
   ========================================== */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 1s linear infinite;
}

/* ==========================================
   MOBILE RESPONSIVENESS IMPROVEMENTS
   ========================================== */
@media (max-width: 768px) {
  .hero-banner {
    padding: 24px 20px;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .upload-zone {
    padding: 32px 16px;
  }

  .json-actions {
    gap: 8px;
  }

  .json-actions .btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .workspace-title {
    font-size: 1.3rem;
  }

  .system-status span {
    display: none;
  }

  .tool-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .main-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .main-workspace {
    padding: 16px 14px;
  }

  .tool-card {
    padding: 18px;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .preview-container {
    flex-direction: column;
  }

  .preview-box {
    max-width: 100%;
  }

  .text-area-grid {
    grid-template-columns: 1fr;
  }
}
