:root {
  --bg-primary: var(--background);
  color-scheme: light dark;
  --tool-panel-surface: rgba(255, 255, 255, 0.94);
  --tool-panel-surface-soft: rgba(255, 255, 255, 0.72);
  --tool-panel-subtle: rgba(15, 23, 42, 0.03);
  --tool-panel-border: rgba(13, 110, 253, 0.18);
}

.dark-theme {
  --bg-primary: #0f172a;
  --tool-panel-surface: rgba(15, 23, 42, 0.94);
  --tool-panel-surface-soft: rgba(15, 23, 42, 0.78);
  --tool-panel-subtle: rgba(255, 255, 255, 0.04);
  --tool-panel-border: rgba(148, 163, 184, 0.22);
}

.premium-settings-panel {
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.08), var(--tool-panel-surface)) !important;
  border-color: var(--tool-panel-border) !important;
  color: var(--text) !important;
}

.premium-settings-panel h3,
.premium-settings-panel p,
.premium-settings-panel label,
.premium-settings-panel .form-label {
  color: var(--text) !important;
}

.premium-settings-panel .form-label {
  font-weight: 700;
}

.premium-settings-panel input[type="checkbox"] {
  accent-color: var(--accent);
}

.tool-workspace {
  gap: 15px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--tool-panel-subtle) !important;
}

.tool-workspace h3,
.tool-workspace p,
.tool-workspace label {
  color: var(--text) !important;
}

.tool-workspace p {
  color: var(--text-muted) !important;
}

.ad-banner-container {
  background: var(--tool-panel-subtle) !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
}

.ad-banner-container > div {
  background: var(--tool-panel-surface-soft) !important;
  color: var(--text-muted) !important;
}

.result-box {
  background: var(--tool-panel-subtle) !important;
  border-color: var(--border) !important;
}

.result-box h4 {
  color: var(--accent) !important;
}

.result-box textarea {
  background: var(--bg-primary) !important;
  color: var(--text) !important;
}

.tool-page-container .section {
  color: var(--text) !important;
}

.tool-page-container .section h2,
.tool-page-container .section h3,
.tool-page-container .section p,
.tool-page-container .section li {
  color: var(--text) !important;
}

.tool-page-container .section p,
.tool-page-container .section li {
  line-height: 1.8;
}

/* Hero Catalog Title Gradient Visibility overrides */
.tool-header-block h1 {
  background: linear-gradient(135deg, var(--text) 0%, rgba(15, 23, 42, 0.8) 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

.dark-theme .tool-header-block h1 {
  background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.7) 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

/* Header Control Buttons, Icons & SVGs Visibility */
.action-btn {
  background: rgba(15, 23, 42, 0.04) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.dark-theme .action-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: var(--text) !important;
}

.action-btn i,
.action-btn svg,
.mobile-toggle i,
.mobile-toggle svg {
  color: var(--text) !important;
  fill: currentColor !important;
  display: inline-block !important;
  font-size: 16px !important;
}

.mobile-toggle {
  background: rgba(15, 23, 42, 0.04) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm);
  padding: 8px !important;
  display: none !important;
  align-items: center;
  justify-content: center;
  color: var(--text) !important;
}

.dark-theme .mobile-toggle {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Category Filter Tags Contrast Fixes */
.filter-tag-btn {
  background: rgba(15, 23, 42, 0.04) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}

.dark-theme .filter-tag-btn {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--border) !important;
}

.filter-tag-btn.active {
  background: var(--accent) !important;
  color: #ffffff !important;
  border-color: var(--accent) !important;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.24) !important;
}

.dark-theme .filter-tag-btn.active {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #60a5fa !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3) !important;
}

/* Tool Cards Background and Contrast Override */
.tool-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9)) !important;
  border: 1px solid var(--border) !important;
}

.dark-theme .tool-card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.tool-card:hover {
  border-color: var(--accent) !important;
}

.dark-theme .tool-card:hover {
  border-color: rgba(59, 130, 246, 0.45) !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45) !important;
}

.tool-title {
  color: var(--text) !important;
}

.tool-desc {
  color: #475569 !important; /* High contrast text-muted for light mode */
}

.dark-theme .tool-desc {
  color: #94a3b8 !important; /* High contrast text-muted for dark mode */
}

/* Mobile Navigation Drawer */
.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1015;
}

body.nav-drawer-open {
  overflow: hidden;
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(86vw, 340px);
  height: 100vh;
  background: var(--secondary);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1020;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.nav-drawer.open {
  transform: translateX(0);
}

.nav-drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.nav-drawer-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.nav-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav-menu--drawer {
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  white-space: normal !important;
}

.nav-menu--drawer li {
  width: 100%;
}

.nav-menu--drawer .nav-link {
  width: 100% !important;
  justify-content: flex-start !important;
  padding: 12px 10px !important;
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

.nav-menu--drawer .nav-link::after {
  display: none !important;
}

.nav-menu--drawer .nav-link:hover,
.nav-menu--drawer .nav-link.active {
  background: rgba(var(--primary-rgb), 0.08) !important;
  border-color: rgba(var(--primary-rgb), 0.14) !important;
}

.nav-menu--drawer .dropdown-menu {
  position: static !important;
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  margin-top: 0 !important;
  opacity: 0 !important;
  visibility: visible !important;
  transform: none !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 0 0 10px !important;
  background: transparent !important;
  display: grid !important;
  gap: 4px !important;
  max-height: 0 !important;
  overflow: hidden !important;
  transition: max-height 0.28s ease, opacity 0.22s ease, margin-top 0.22s ease, padding 0.22s ease !important;
}

.nav-menu--drawer .dropdown.open .dropdown-menu {
  max-height: 480px !important;
  margin-top: 8px !important;
  opacity: 1 !important;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}

.nav-menu--drawer .dropdown-item {
  padding: 8px 10px !important;
}

@media (max-width: 768px) {
  .header-container nav {
    display: none !important;
  }

  .mobile-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
  }

  .header-tools {
    gap: 8px !important;
  }

  .header-tools .search-wrapper {
    width: 160px !important;
  }
}

/* Hero Sphere Graphic & Floating Objects */
.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 400px;
}

.sphere-canvas {
  width: 320px;
  height: 320px;
  position: relative;
  perspective: 1000px;
}

.floating-object {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff !important;
  transition: var(--transition);
}

.obj-pdf {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(220, 38, 38, 0.6)) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  top: 10%;
  left: 10%;
  animation: floatPDF 8s ease-in-out infinite;
}

.obj-jpg {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(21, 128, 61, 0.6)) !important;
  border-color: rgba(34, 197, 94, 0.4) !important;
  bottom: 10%;
  right: 10%;
  animation: floatJPG 10s ease-in-out infinite;
}

.obj-convert {
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.3), rgba(37, 99, 235, 0.6)) !important;
  border-color: rgba(13, 110, 253, 0.4) !important;
  top: 40%;
  left: 45%;
  animation: rotateConvert 12s linear infinite;
}

@keyframes floatPDF {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(15deg); }
}

@keyframes floatJPG {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(20px) rotate(-15deg); }
}

@keyframes rotateConvert {
  0% { transform: rotate(0deg) translate(0,0) scale(1); }
  50% { transform: rotate(180deg) translate(10px,-10px) scale(1.1); }
  100% { transform: rotate(360deg) translate(0,0) scale(1); }
}

/* Page Layout & Container Alignment Fixes */
.container {
  max-width: 1400px !important;
  margin: 0 auto !important;
  padding: 0 24px !important;
  width: 100% !important;
}

/* Desktop Navigation Menu Spacing */
.nav-menu {
  gap: 10px !important;
}

.nav-link {
  font-size: 13px !important;
  letter-spacing: 0.1px !important;
}

/* Premium Search CSS Overrides */
.search-wrapper {
  width: 204px !important;
}

.search-input {
  background: rgba(15, 23, 42, 0.05) !important;
  border: 1.5px solid var(--border) !important;
  color: var(--text) !important;
  padding: 9px 14px 9px 36px !important;
  font-size: 14px !important;
  border-radius: 50px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.dark-theme .search-input {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.search-input:focus {
  background: var(--secondary) !important;
  border-color: var(--accent-color, var(--accent)) !important;
  box-shadow: 0 0 0 4px var(--accent-glow, rgba(13, 110, 253, 0.2)) !important;
}

.search-icon {
  left: 13px !important;
  color: var(--text-muted) !important;
}

.header-tools .accent-selector--header {
  gap: 3px !important;
  padding: 2px 5px !important;
}

.header-tools .action-btn {
  width: 34px !important;
  height: 34px !important;
}

.dark-theme .header-tools .accent-selector--header {
  background: rgba(15, 23, 42, 0.44) !important;
}

/* Footer Social Icons Flex layout */
.social-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #ffffff !important;
}

.social-icon svg {
  color: #ffffff !important;
  fill: currentColor !important;
}

/* Scratchpad Drawer Close Button Contrast */
#closeScratchpad {
  background: rgba(15, 23, 42, 0.05) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: 50% !important;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.dark-theme #closeScratchpad {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

#closeScratchpad:hover {
  background: rgba(239, 64, 64, 0.15) !important;
  color: #ef4444 !important;
  border-color: rgba(239, 64, 64, 0.3) !important;
}

/* Footer Social Links Flex spacing */
.social-links {
  display: flex !important;
  flex-direction: row !important;
  gap: 12px !important;
  margin-top: 15px !important;
  justify-content: flex-start !important;
}

.social-icon {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.25s ease !important;
}

.social-icon:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  transform: translateY(-3px) !important;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb, 13, 110, 253), 0.3) !important;
}

/* Footer bottom responsive styling */
@media (max-width: 768px) {
  .footer-bottom {
    flex-direction: column !important;
    gap: 12px !important;
    text-align: center !important;
  }
}
