:root {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-alt: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-secondary: #0f172a;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-card: #1f2937;
  --bg-alt: #1e293b;
  --text-main: #f9fafb;
  --text-muted: #e2e8f0;
  --border-color: #374151;
  --brand-primary: #3b82f6;
  --brand-primary-hover: #60a5fa;
  --brand-secondary: #f8fafc;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] small.text-muted,
[data-theme="dark"] span.text-muted,
[data-theme="dark"] p.text-muted,
[data-theme="dark"] div.text-muted {
  color: #e2e8f0 !important;
  opacity: 1 !important;
}

/* Dropdown Menu Text in Dark Mode */
[data-theme="dark"] .dropdown-menu {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
  color: #ffffff !important;
}

[data-theme="dark"] .dropdown-item,
[data-theme="dark"] .dropdown-item *,
[data-theme="dark"] .dropdown-menu *,
[data-theme="dark"] .dropdown-menu a,
[data-theme="dark"] .nav-link {
  color: #ffffff !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:hover * {
  background-color: #374151 !important;
  color: #ffffff !important;
}

/* Technical Disclaimer Label */
.technical-disclaimer-label {
  color: #000000 !important;
  font-weight: 700;
}

[data-theme="dark"] .bg-light {
  background-color: var(--bg-alt) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .card {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-color);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: var(--bg-surface);
  color: var(--text-main);
}

html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navbar */
.navbar-custom {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.5rem;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-main) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  background: linear-gradient(135deg, var(--brand-primary), #4f46e5);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Hero Section */
.hero-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 3.5rem 1.5rem 4rem;
  border-radius: var(--radius-xl);
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: visible !important;
}

.hero-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 90% 20%, rgba(59, 130, 246, 0.25) 0%, rgba(0, 0, 0, 0) 65%);
  pointer-events: none;
  border-radius: var(--radius-xl);
}

.hero-title {
  font-weight: 800;
  font-size: 2.5rem;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 1.85rem;
  }
}

.hero-subtitle {
  color: #cbd5e1;
  font-size: 1.15rem;
  max-width: 680px;
}

/* Search Box */
.search-wrapper {
  position: relative;
  max-width: 650px;
  margin-top: 1.5rem;
  z-index: 100;
}

.search-input {
  background-color: rgba(255, 255, 255, 0.95);
  border: 2px solid transparent;
  border-radius: 9999px;
  padding: 0.85rem 1.5rem 0.85rem 3.2rem;
  font-size: 1rem;
  color: #0f172a;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.search-input:focus {
  background-color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
  outline: none;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 1.15rem;
}

/* Search Results Dropdown */
.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-top: 0.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000 !important;
  display: none;
  text-align: left !important;
}

.search-result-item {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.search-result-item:hover {
  background-color: var(--bg-alt);
  color: var(--brand-primary);
}

.search-result-item:last-child {
  border-bottom: none;
}

/* Cards & Grids */
.tool-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  text-decoration: none !important;
  color: var(--text-main);
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-primary);
  color: var(--text-main);
}

.tool-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.category-badge {
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 0.375rem;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.fav-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.fav-btn:hover, .fav-btn.active {
  color: #f59e0b;
  transform: scale(1.15);
}

.category-banner-card {
  border-radius: var(--radius-xl);
  padding: 2rem;
  color: #ffffff;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

/* Tool Interface Layout */
.tool-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.tool-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
}

.tool-output-box {
  background-color: var(--bg-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-main);
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background-color: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

/* Toast Notifications */
.toast-container-custom {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
}

.custom-toast {
  background-color: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.3s ease forwards;
}

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

/* Footer */
footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  padding: 3rem 0 1.5rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--brand-primary);
}

/* Home Categories Dropdown Above Search Bar */
.home-categories-wrapper {
  position: relative;
  z-index: 10500 !important;
}

.home-categories-dropdown-menu {
  z-index: 10500 !important;
}
