/* =====================
   THEME VARIABLES
   ===================== */

:root {
  --bg: #0e0e0e;
  --fg: #e0e0e0;
  --accent: #00ffcc;
  --card-bg: #1a1a1a;
  --card-hover: #222222;
  --accent-rgb: 0, 255, 204;
}

[data-theme="light"] {
  --bg: #f9f9fb;
  --fg: #111111;
  --accent: #007acc;
  --card-bg: #ffffff;
  --card-hover: #f0f4f8;
  --accent-rgb: 0, 122, 204;
}

[data-theme="dark"] {
  --bg: #0e0e0e;
  --fg: #e0e0e0;
  --accent: #00ffcc;
  --card-bg: #1a1a1a;
  --card-hover: #222222;
}

/* =====================
   GLOBAL STYLES
   ===================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  overflow-x: hidden;
}

/* =====================
   SIDEBAR
   ===================== */



.sidebar {
  width: 260px;
  background: rgba(15, 15, 15, 0.85);
  backdrop-filter: blur(10px);
  padding: 1rem;
  height: calc(100vh - 60px);
  position: fixed;
  left: 0;
  top: 60px;
  overflow-y: auto;
  border-right: 1px solid #333;
  transition: transform 0.3s ease-in-out;
  z-index: 1000;
}

.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.sidebar-toggle {
  position: fixed;
  left: 10px;
  top: 10px;
  background: var(--accent);
  border: none;
  color: black;
  font-size: 1.2rem;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  z-index: 1100;
}

.sidebar-nav h2 {
  color: var(--accent);
  font-size: 1.2rem;
  margin-top: 0;
}

.sidebar-nav ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.sidebar-nav ul ul {
  margin-left: 1rem;
  padding-left: 0;
}

.sidebar-nav ul ul li {
  margin: 4px 0;
}

.sidebar-nav li {
  margin: 6px 0;
}

.sidebar-nav a {
  color: var(--fg);
  text-decoration: none;
  display: block;
  padding: 3px 0;
}

.sidebar-nav a:hover {
  color: white;
}

.sidebar-search {
  margin-bottom: 1rem;
}

.sidebar-search input {
  width: 100%;
  padding: 8px;
  border-radius: 5px;
  border: none;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.sidebar-nav strong {
  color: var(--accent);
  font-size: 1.1rem;
  display: block;
  margin: 0.5rem 0;
}

/* =====================
   MAIN CONTENT
   ===================== */

.main-content {
  margin-left: 260px;
  margin-top: 60px;
  padding: 2rem;
  flex: 1;
  min-width: 0;
}

.sidebar-collapsed .main-content {
  margin-left: 0;
}

/* =====================
   HERO SECTION
   ===================== */

.hero {
  text-align: center;
  padding: 6rem 2rem 4rem;
  background: radial-gradient(circle at top, var(--card-bg), var(--bg));
}

.hero h1 {
  font-size: 2.8rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: var(--fg);
}

.hero a {
  color: greenyellow;
}

.hero .search-container {
  margin-top: 2rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero #search-bar {
  width: 100%;
  max-width: 800px;
  padding: 1.25rem 1.5rem;
  font-size: 1.4rem;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.hero #search-bar:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 8px rgba(var(--accent-rgb, 0, 255, 204), 0.3);
}

.hero #search-bar::placeholder {
  color: rgba(var(--fg-rgb, 224, 224, 224), 0.6);
  font-style: italic;
}

.btn {
  background: var(--accent);
  color: #000;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  font-weight: bold;
  transition: background 0.3s;
}

.btn:hover {
  background: #00ddb5;
}

[data-theme="light"] .hero {
  background: radial-gradient(circle at top, #ffffff, #f9f9fb);
}

[data-theme="light"] .hero #search-bar {
  background: #ffffff;
  border-color: #ccc;
  color: #111;
}

[data-theme="light"] .hero #search-bar::placeholder {
  color: #888;
}

/* =====================
   CATEGORIES
   ===================== */

.category-box-container {
  display: grid;
  gap: 2rem;
}

.category-box {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 10px;
  transition: background 0.3s;
}

.category-box:hover {
  background: var(--card-hover);
}

.category-box h2 {
  margin-top: 0;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.category-box ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  padding: 0;
  list-style: none;
}

.category-box ul li a {
  display: block;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 6px;
  text-align: center;
  color: var(--fg);
  text-decoration: none;
  transition: background 0.2s ease;
}

.category-box ul li a:hover {
  background: rgba(255, 255, 255, 0.15);
}

.category-box,
.tool-wrapper {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.category-box:hover,
.tool-wrapper:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .category-box ul li a {
  background: #f5f7fa;
  color: #111;
}

[data-theme="light"] .category-box ul li a:hover {
  background: #e4ecf3;
}

[data-theme="light"] .category-box,
[data-theme="light"] .tool-wrapper {
  border: 1px solid #e6e6e6;
}

/* =====================
   FOOTER
   ===================== */

footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.9rem;
  color: #777;
  background: #111;
}

.footer-content p {
  margin: 0 0 1rem;
}

.footer-content nav {
  margin-top: 0.5rem;
}

.footer-content nav a {
  color: var(--accent);
  text-decoration: none;
  margin: 0 0.5rem;
}

.footer-content nav a:hover {
  text-decoration: underline;
}

[data-theme="light"] footer {
  background: #f5f7fa;
}

/* =====================
   THEME TOGGLE
   ===================== */

.theme-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  color: var(--fg);
  cursor: pointer;
  font-size: 16px;
  display: inline-block;
  text-align: center;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* =====================
   RESPONSIVE
   ===================== */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar-collapsed .sidebar {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  .sidebar-toggle {
    left: 10px;
    top: 10px;
  }
}

/* =====================
   PAGE CONTENT CONTAINER
   ===================== */
.page-container {
  max-width: 1000px;
  margin: 0 auto;
  padding-bottom: 4rem;
}

.page-container h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.page-container p {
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

/* =====================
   TOP HEADER
   ===================== */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(15, 15, 15, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 1001;
  border-bottom: 1px solid #333;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-weight: bold;
  font-size: 1.2rem;
  color: var(--accent);
  text-decoration: none;
  padding-left: 50px;
}

.powered-by {
  font-size: 0.85rem;
  color: var(--fg);
}

.powered-by a {
  color: var(--accent);
  text-decoration: underline;
}

.top-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.top-nav a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
}

.top-nav a:hover {
  color: white;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  color: var(--fg);
  cursor: pointer;
  font-size: 16px;
  padding: 6px 10px;
  z-index: 1002;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.nav-toggle {
  display: none;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 1.1rem;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  z-index: 1002;
}

@media (max-width: 768px) {

  .hero .search-container {
    margin-top: 1.5rem;
  }
  .hero #search-bar {
    max-width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.2rem;
    border-radius: 8px;
  }

  .top-nav {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(15, 15, 15, 0.95);
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid #333;
  }

  .top-nav.show {
    display: flex;
  }

  .nav-toggle {
    display: block;
    position: absolute;
    right: 60px;
    top: 14px;
  }

  .theme-toggle {
    position: absolute;
    right: 10px;
    top: 10px;
  }

  .header-left {
    gap: 0.5rem;
  }

  .logo {
    padding-left: 50px;
    font-size: 1rem;
  }

  .powered-by {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 100%;
    max-width: 260px;
  }

  .sidebar-collapsed .sidebar {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .sidebar-toggle {
    left: 10px;
    top: 10px;
  }
}


/* Hidden class for search filtering */
.hidden {
  display: none;
}

/* No results message for main search */
.no-results {
  color: var(--fg);
  margin-top: 20px;
  font-size: 1rem;
  text-align: center;
}

/* Sidebar search live region */
#sidebar-search-results {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* =====================
   DEFAULT BUTTON STYLING
   ===================== */
button {
  background: var(--accent); /* #00ffcc dark, #007acc light */
  color: #000; /* High contrast text */
  border: none;
  border-radius: 6px; /* Matches .theme-toggle */
  padding: 0.75rem 1.5rem; /* Matches .btn */
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, box-shadow 0.3s;
}

button:hover {
  background: #00ddb5; /* Dark mode hover */
  box-shadow: 0 2px 8px rgba(var(--accent-rgb, 0, 255, 204), 0.3);
}

[data-theme="light"] button:hover {
  background: #005f99; /* Light mode hover */
  box-shadow: 0 2px 8px rgba(var(--accent-rgb, 0, 122, 204), 0.3);
}

button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 0, 255, 204), 0.5);
}

button:disabled {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(var(--fg-rgb, 224, 224, 224), 0.5);
  cursor: not-allowed;
}

/* =====================
   TOOL WRAPPER (UNIVERSAL)
   ===================== */

.tool-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
  background: var(--card-bg);
  border-radius: 10px;
  position: relative;
  z-index: 10;
}

.tool-wrapper h1 {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.tool-wrapper h2 {
  font-size: 1.5rem;
  color: var(--accent);
  margin: 1rem 0 0.5rem;
}

.tool-wrapper p {
  font-size: 1rem;
  color: var(--fg);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.tool-wrapper .calculator {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.tool-wrapper .error-message {
  color: #ff4d4d;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.tool-wrapper .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 768px) {
  .tool-wrapper {
    padding: 1rem;
  }
  
  .tool-wrapper h1 {
    font-size: 1.8rem;
  }
  
  .tool-wrapper h2 {
    font-size: 1.3rem;
  }
  
  .tool-wrapper .calculator {
    padding: 0.75rem;
  }
}

/* =====================
   Webkit Scrollbar
   ===================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

body::-webkit-scrollbar {
  opacity: 0;
  transition: opacity 0.3s;
}

body:hover::-webkit-scrollbar {
  opacity: 1;
}

/* =====================
   Light Theme Sidebar, Footer, Header
   ===================== */
[data-theme="light"] .top-header {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid #ddd;
}

[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid #ddd;
}

[data-theme="light"] .footer {
  background: #f4f4f4;
  color: #555;
}

[data-theme="light"] .footer-content nav a {
  color: var(--accent);
}

[data-theme="light"] .footer-content nav a:hover {
  text-decoration: underline;
}

/* Sidebar links */
[data-theme="light"] .sidebar-nav a {
  color: #111;
}

[data-theme="light"] .sidebar-nav a:hover {
  color: #007acc;
}

[data-theme="light"] .sidebar-search input {
  background: rgba(0, 0, 0, 0.05);
  color: #111;
}

[data-theme="light"] .theme-toggle {
  background: rgba(0, 0, 0, 0.05);
  color: #111;
}

[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .top-nav a {
  color: #111;
}

[data-theme="light"] .top-nav a:hover {
  color: #007acc;
}

[data-theme="light"] .powered-by {
  color: #555;
}
