/* ============================================================
   ULTIMATE TOOLS BAAZAR — Premium Design System
   ============================================================ */

:root {
  /* Light theme */
  --bg: #f7f9fc;
  --bg-gradient: linear-gradient(135deg, #f7f9fc 0%, #eef2f9 100%);
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --surface-elevated: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f9;
  --border: #e5e9f0;
  --border-strong: #d1d9e6;
  --border-color: #e5e9f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #ec4899;
  --accent-soft: #fce7f3;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --text-dim: #94a3b8;
  --input-bg: #ffffff;
  --input-border: #e5e9f0;
  --panel: #ffffff;
  --card: #ffffff;
  --bg-color: #f7f9fc;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 0 4px rgba(79, 70, 229, 0.12);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0b0e14;
  --bg-gradient: linear-gradient(135deg, #0b0e14 0%, #111827 100%);
  --surface: #151a23;
  --surface-hover: #1c222d;
  --surface-elevated: #1a1f2a;
  --surface-2: #1c222d;
  --surface-3: #252c3a;
  --border: #262d3a;
  --border-strong: #374151;
  --border-color: #262d3a;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.12);
  --accent: #f472b6;
  --accent-soft: rgba(244, 114, 182, 0.12);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --text-dim: #64748b;
  --input-bg: #151a23;
  --input-border: #262d3a;
  --panel: #151a23;
  --card: #1a1f2a;
  --bg-color: #0b0e14;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  padding: 20px;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  line-height: 1.5;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  max-width: 1100px;
  margin: 0 auto 28px;
  text-align: center;
  position: relative;
  padding: 40px 20px 20px;
}

.header h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header p {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
}

.theme-btn {
  position: absolute;
  right: 0;
  top: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.theme-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ============================================================
   SEARCH
   ============================================================ */
.search-container {
  max-width: 700px;
  margin: 0 auto 24px;
  position: relative;
}

.search-container input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  font-size: 15px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  font-family: inherit;
}
.search-container input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-1px);
}

.search-container::before {
  content: '🔍';
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  opacity: 0.6;
}

/* ============================================================
   CATEGORY FILTER
   ============================================================ */
.category-wrapper {
  max-width: 1100px;
  margin: 0 auto 32px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.category-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
  opacity: 0.6;
}

.category-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.chip {
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.chip .chip-emoji {
  font-size: 16px;
  line-height: 1;
  transition: transform var(--transition);
  display: inline-block;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.15);
}

.chip:hover .chip-emoji {
  transform: scale(1.2) rotate(-8deg);
}

.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
  transform: translateY(-2px);
}

.chip.active .chip-emoji {
  transform: scale(1.15);
}

/* ============================================================
   TOOL GRID
   ============================================================ */
.dashboard-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.tool-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
  display: block;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.4s ease backwards;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-card:hover {
  transform: translateY(-4px);
  background: var(--surface-hover);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-icon {
  font-size: 34px;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--primary-soft);
  border-radius: var(--radius);
  transition: transform var(--transition);
}

.tool-card:hover .tool-icon {
  transform: scale(1.08) rotate(-4deg);
}

.tool-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: -0.3px;
}

.tool-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.tool-card .tool-category {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

/* Empty state */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 15px;
}
.no-results i {
  font-size: 48px;
  display: block;
  margin-bottom: 14px;
  opacity: 0.4;
  font-style: normal;
}

/* ============================================================
   TOOL SUB-PAGES
   ============================================================ */
.tool-container {
  max-width: 800px;
  margin: 30px auto;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.tool-container.wide {
  max-width: 1100px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.back-link:hover {
  background: var(--primary-soft);
  transform: translateX(-2px);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  margin: 8px 0 16px 0;
  font-size: 14.5px;
  outline: none;
  font-family: inherit;
  transition: all var(--transition);
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.action-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  padding: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  width: 100%;
  font-size: 15px;
  font-family: inherit;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}
.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.4);
}
.action-btn:active {
  transform: translateY(0);
}

.result-box {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-top: 18px;
  font-size: 14.5px;
  line-height: 1.6;
  animation: slideIn 0.3s ease;
}

/* ============================================================
   FEEDBACK SECTION
   ============================================================ */
.feedback-section {
  max-width: 700px;
  margin: 60px auto 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.feedback-section h3 {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.feedback-section p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.55;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  text-align: center;
  padding: 40px 20px 20px;
  color: var(--text-muted);
  font-size: 13px;
}
footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================================
   ACCESSIBILITY — FOCUS VISIBLE
   ============================================================ */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .theme-btn,
  .search-container,
  .category-wrapper,
  .feedback-section,
  footer,
  .back-link {
    display: none !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
    padding: 0;
  }
  .tool-card {
    border: 1px solid #ccc;
    box-shadow: none;
    page-break-inside: avoid;
  }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-2) 0%,
    var(--surface-3) 50%,
    var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  body { padding: 14px; }
  .header { padding: 30px 16px 16px; }
  .theme-btn { position: static; margin-top: 14px; }
  .dashboard-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .tool-card { padding: 20px 16px; }
  .tool-icon { width: 46px; height: 46px; font-size: 26px; margin-bottom: 10px; }
  .tool-card h3 { font-size: 14.5px; }
  .tool-card p { font-size: 12px; }
  .tool-card .tool-category { display: none; }
  .tool-container { padding: 22px; }
  .feedback-section { padding: 22px; }
  .category-wrapper {
    padding: 14px 12px;
    margin-bottom: 24px;
  }
  .category-chips { gap: 8px; }
  .chip { padding: 9px 16px; font-size: 13px; }
  .chip .chip-emoji { font-size: 14px; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .chip { padding: 8px 14px; font-size: 12px; gap: 6px; }
  .chip .chip-emoji { font-size: 13px; }
}