/*
Theme Name: ToolStack
Theme URI: https://toolstack.app
Author: ToolStack
Author URI: https://toolstack.app
Description: ToolStack â€“ 100+ free online tools as WordPress shortcodes. Violet/indigo design, all tools run client-side.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: toolstack
Tags: tools, utilities, shortcodes, violet, indigo
*/

/* CSS Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #8b5cf6;
  --primary-dark: #7c3aed;
  --primary-light: #a78bfa;
  --background: #f8fafc;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-border: #e2e8f0;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --destructive: #ef4444;
  --radius: 0.75rem;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px 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);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

/* =====================
   HEADER
   ===================== */
.ts-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
}

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

.ts-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--foreground);
  text-decoration: none;
}

.ts-logo-icon {
  background: var(--primary);
  color: white;
  padding: 0.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

/* WordPress primary nav */
.ts-primary-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ts-primary-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}

.ts-primary-nav ul li {
  position: relative;
}

.ts-primary-nav ul li a {
  display: block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--foreground);
  transition: all 0.2s;
  white-space: nowrap;
}

.ts-primary-nav ul li a:hover,
.ts-primary-nav ul li.current-menu-item > a {
  background: var(--muted);
  color: var(--primary);
}

/* Dropdown sub-menus */
.ts-primary-nav ul li ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  z-index: 1000;
  flex-direction: column;
  gap: 0;
}

.ts-primary-nav ul li:hover > ul {
  display: flex;
  flex-direction: column;
}

.ts-primary-nav ul li ul li a {
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
}

/* Mobile toggle */
.ts-mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1.25rem;
  color: var(--foreground);
}

.ts-mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--card);
  border-top: 1px solid var(--card-border);
  padding: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.ts-mobile-nav.open {
  display: flex;
}

.ts-mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ts-mobile-nav ul li a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--foreground);
  transition: background 0.2s;
}

.ts-mobile-nav ul li a:hover {
  background: var(--muted);
  color: var(--primary);
}

.ts-mobile-nav ul ul {
  padding-left: 1rem;
}

@media (max-width: 768px) {
  .ts-primary-nav { display: none !important; }
  .ts-mobile-toggle { display: block; }
}

/* =====================
   MAIN CONTENT
   ===================== */
#ts-content {
  flex: 1;
  padding: 2rem 0;
}

/* =====================
   FOOTER
   ===================== */
.ts-footer {
  background: var(--muted);
  border-top: 1px solid var(--card-border);
  padding: 3rem 0 0;
  margin-top: auto;
}

.ts-footer-widgets {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  padding-bottom: 2rem;
}

@media (max-width: 768px) {
  .ts-footer-widgets { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .ts-footer-widgets { grid-template-columns: 1fr; }
}

.ts-footer-nav {
  padding: 1.5rem 0;
  border-top: 1px solid var(--card-border);
  text-align: center;
}

.ts-footer-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.5rem;
  margin: 0 0 1rem;
  padding: 0;
}

.ts-footer-nav ul li a {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  transition: color 0.2s;
}

.ts-footer-nav ul li a:hover {
  color: var(--primary);
}

.ts-footer-bottom {
  border-top: 1px solid var(--card-border);
  padding: 1.25rem 0;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* Widget area titles */
.widget-title,
.widgettitle {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.widget ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.widget ul li {
  margin-bottom: 0.5rem;
}

.widget ul li a {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  transition: color 0.2s;
}

.widget ul li a:hover {
  color: var(--primary);
}

/* ToolStack Logo Widget */
.ts-logo-widget .ts-logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: var(--foreground);
}

.ts-logo-widget .ts-logo-wrap .ts-logo-icon {
  background: var(--primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.ts-logo-widget p {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.7;
}

/* =====================
   BREADCRUMB
   ===================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--muted-foreground);
  transition: color 0.2s;
}

.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .separator { color: var(--card-border); font-size: 0.75rem; }
.breadcrumb .current { color: var(--foreground); font-weight: 500; }

/* =====================
   BUTTONS
   ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-outline { background: transparent; border: 1px solid var(--card-border); color: var(--foreground); }
.btn-outline:hover { background: var(--muted); border-color: var(--primary); }
.btn-outline.active { background: var(--primary); color: white; border-color: var(--primary); }

.btn-ghost { background: transparent; color: var(--muted-foreground); }
.btn-ghost:hover { background: var(--muted); color: var(--foreground); }

.btn-destructive { background: transparent; color: var(--muted-foreground); }
.btn-destructive:hover { color: var(--destructive); }

/* =====================
   CARDS
   ===================== */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
}

.card:hover { box-shadow: var(--shadow-lg); }
.card-header { padding: 1.5rem; }
.card-content { padding: 1.5rem; }

.card-icon {
  width: 48px;
  height: 48px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 1rem;
}

.card-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.card-description { color: var(--muted-foreground); font-size: 0.875rem; }

.card-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 1rem;
  transition: gap 0.2s;
}

.card:hover .card-link { gap: 0.5rem; }

/* =====================
   FORM ELEMENTS
   ===================== */
.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.ts-tool input[type="text"],
.ts-tool input[type="email"],
.ts-tool input[type="number"],
.ts-tool input[type="url"],
.ts-tool input[type="date"],
.ts-tool input[type="time"],
.ts-tool textarea,
.ts-tool select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card);
  transition: all 0.2s;
  font-family: inherit;
}

.ts-tool input:focus,
.ts-tool textarea:focus,
.ts-tool select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ts-tool textarea {
  resize: vertical;
  min-height: 200px;
  font-family: 'JetBrains Mono', monospace;
}

.ts-tool input[type="color"] {
  width: 48px;
  height: 48px;
  padding: 4px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
}

.ts-tool input[type="range"] {
  width: 100%;
  height: 8px;
  background: var(--muted);
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
}

.ts-tool input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
}

.ts-tool input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.1); }

/* Switch */
.switch-wrapper { display: flex; align-items: center; gap: 0.75rem; }

.switch { position: relative; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--muted);
  transition: 0.3s;
  border-radius: 24px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.switch input:checked + .switch-slider { background-color: var(--primary); }
.switch input:checked + .switch-slider:before { transform: translateX(20px); }

/* =====================
   STATS
   ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-value { font-size: 1.5rem; font-weight: 700; }

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted-foreground);
  letter-spacing: 0.05em;
}

/* =====================
   TOOL PAGE LAYOUT
   ===================== */
.tool-header { margin-bottom: 2rem; }
.tool-header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.tool-header p { color: var(--muted-foreground); }

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
}

/* Result Box */
.result-box {
  background: var(--muted);
  border-radius: var(--radius);
  padding: 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
  min-height: 60px;
}

.result-large {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}

/* QR Display */
.qr-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
}

.qr-wrapper {
  background: white;
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* Color Preview */
.color-preview {
  height: 150px;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background-color 0.2s;
}

/* Diff Output */
.diff-output {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  white-space: pre-wrap;
}

.diff-added { background: rgba(34, 197, 94, 0.2); color: #166534; display: block; }
.diff-removed { background: rgba(239, 68, 68, 0.2); color: #991b1b; display: block; }

/* UUID / Name List */
.uuid-list {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.uuid-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--card-border);
  transition: background 0.2s;
}

.uuid-item:last-child { border-bottom: none; }
.uuid-item:hover { background: var(--muted); }
.uuid-item .btn { opacity: 0; transition: opacity 0.2s; }
.uuid-item:hover .btn { opacity: 1; }

/* Image preview */
.image-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  background: var(--muted);
  border-radius: var(--radius);
  padding: 2rem;
}

.image-preview img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 4px solid white;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--foreground);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 9999;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* Health disclaimer */
.health-disclaimer {
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #854d0e;
}

/* Hero */
.hero { text-align: center; max-width: 800px; margin: 0 auto 3rem; }
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; line-height: 1.2; }
.hero p { font-size: 1.25rem; color: var(--muted-foreground); }

/* Tools Grid */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }

/* Page Content */
.page-content {max-width: 1200px;margin: 0 auto;}
.page-content h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.page-content h2 { font-size: 1.5rem; font-weight: 700; margin: 2rem 0 1rem; }
.page-content h3 { font-size: 1.25rem; font-weight: 600; margin: 2rem 0 1rem; }
.page-content p { color: var(--muted-foreground); margin-bottom: 1rem; line-height: 1.8; }

/* Utility Classes */
.text-center { text-align: center; }
.text-muted { color: var(--muted-foreground); }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }

@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .tools-grid { grid-template-columns: 1fr; }
}
