/* ==================================================
   Tools.PrasunBarua.com - Main Stylesheet
   Design System, Components & Dark Theme Support
================================================== */

/* ==========================================
   1. DESIGN SYSTEM & ROOT VARIABLES
========================================== */
:root {
  /* Color System - Light Theme (Default) */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-ring: rgba(37, 99, 235, 0.2);
  
  --secondary: #0f172a;
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);
  --shadow-dropdown: 0 20px 35px rgba(15, 23, 42, 0.18);

  /* Geometry & Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --container-max: 1200px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Color System - Dark Theme */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-ring: rgba(59, 130, 246, 0.3);

  --secondary: #f8fafc;
  --background: #090d16;
  --surface: #111827;
  --surface-hover: #1f2937;

  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --border: #1f2937;
  --border-hover: #374151;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.45);
  --shadow-dropdown: 0 20px 35px rgba(0, 0, 0, 0.65);
}

/* ==========================================
   2. CSS RESET & GLOBAL BASE
========================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

input {
  font-family: inherit;
}

/* Layout Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================
   3. HEADER & NAVIGATION
========================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

[data-theme="dark"] .header {
  background-color: rgba(17, 24, 39, 0.85);
}

.header-inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo a {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--primary);
}

.navigation {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle Button */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface-hover);
  border: 1px solid var(--border);
  font-size: 1.1rem;
  transition: var(--transition-fast);
}

.theme-toggle:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.theme-icon-light { display: block; }
.theme-icon-dark { display: none; }

[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.mobile-menu-btn span {
  width: 22px;
  height: 2px;
  background-color: var(--text);
  transition: var(--transition-fast);
}

/* ==========================================
   4. HERO SECTION & GOOGLE-STYLE SEARCH
========================================== */
.hero {
  padding: 70px 0 50px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background-color: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -1px;
  max-width: 850px;
  margin: 0 auto 16px;
  color: var(--text);
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 36px;
}

/* Search Bar Wrapper */
.google-search {
  position: relative;
  max-width: 650px;
  margin: 0 auto;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 20px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.search-wrapper input[type="search"] {
  width: 100%;
  height: 56px;
  padding: 0 48px 0 54px;
  font-size: 1.05rem;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  outline: none;
  transition: var(--transition-fast);
}

.search-wrapper input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-wrapper input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-ring), var(--shadow-lg);
}

.clear-search-btn {
  position: absolute;
  right: 18px;
  font-size: 1.4rem;
  color: var(--text-muted);
  line-height: 1;
}

.clear-search-btn:hover {
  color: var(--text);
}

/* Search Dropdown Results */
.search-results-dropdown {
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  z-index: 99;
  max-height: 420px;
  overflow-y: auto;
  padding: 8px;
  text-align: left;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.search-result-item:hover,
.search-result-item.highlighted {
  background-color: var(--primary-light);
}

.search-result-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.search-result-content {
  flex-grow: 1;
  min-width: 0;
}

.search-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.search-result-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-category {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  background-color: var(--surface-hover);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  white-space: nowrap;
}

.search-result-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.search-no-match {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ==========================================
   5. CATEGORIES SECTION
========================================== */
.categories {
  padding: 60px 0;
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 40px;
}

.section-header h2 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

.category-card:hover,
.category-card.active {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.category-card.active {
  background-color: var(--primary-light);
}

.category-icon {
  font-size: 2rem;
  margin-bottom: 14px;
}

.category-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.category-info p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.category-link-hint {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 16px;
  display: inline-block;
}

/* ==========================================
   6. TOOLS GRID SECTION
========================================== */
.tools-section {
  padding: 60px 0;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-header-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header-inline h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.filter-badge {
  font-size: 0.85rem;
  font-weight: 600;
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

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

.tool-card {
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.tool-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tool-card-icon {
  font-size: 1.8rem;
}

.tool-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.tool-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  flex-grow: 1;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.tool-card-cat {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--surface);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

.tool-card-action {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: transform var(--transition-fast);
}

.tool-card:hover .tool-card-action {
  transform: translateX(3px);
}

/* Empty Results State */
.no-results {
  text-align: center;
  padding: 60px 20px;
}

.no-results-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.no-results h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.no-results p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.btn-secondary {
  padding: 10px 20px;
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: background-color var(--transition-fast);
}

.btn-secondary:hover {
  background-color: var(--primary-hover);
}

/* ==========================================
   7. ABOUT SECTION
========================================== */
.about {
  padding: 70px 0;
}

.about-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  max-width: 850px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}

.about-card h2 {
  font-size: 1.75rem;
  margin-bottom: 16px;
}

.about-card p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ==========================================
   8. FOOTER
========================================== */
.footer {
  background-color: var(--secondary);
  color: #94a3b8;
  padding-top: 60px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 40px;
  padding-bottom: 50px;
}

.brand-col h3 {
  color: #ffffff;
  font-size: 1.35rem;
  margin-bottom: 12px;
}

.brand-col h3 span {
  color: var(--primary);
}

.brand-col p {
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer-section h4 {
  color: #ffffff;
  font-size: 1rem;
  margin-bottom: 16px;
  font-weight: 700;
}

.footer-section a {
  display: block;
  font-size: 0.875rem;
  color: #94a3b8;
  margin-bottom: 10px;
  transition: color var(--transition-fast);
}

.footer-section a:hover {
  color: #ffffff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 0;
  text-align: center;
  font-size: 0.85rem;
}
