/* ============================================
   ToolBox Online — Design System
   Mobile-First • Dark Mode • Modern
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- Custom Properties --- */
:root {
  --bg-primary: #0f0b1a;
  --bg-secondary: #1a1430;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(124, 58, 237, 0.4);

  --text-primary: #f1f0f5;
  --text-secondary: #a8a3b8;
  --text-muted: #6b6580;

  --accent-purple: #7c3aed;
  --accent-blue: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;

  --gradient-main: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  --gradient-warm: linear-gradient(135deg, #ec4899 0%, #f59e0b 100%);
  --gradient-cool: linear-gradient(135deg, #06b6d4 0%, #7c3aed 100%);
  --gradient-bg: radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
                 radial-gradient(ellipse at 80% 20%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
                 radial-gradient(ellipse at 50% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 50%);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-bg);
  pointer-events: none;
  z-index: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg {
  max-width: 100%;
  display: block;
}

/* --- Layout --- */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Navigation --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 11, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 0;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.nav-logo svg {
  width: 32px;
  height: 32px;
}

.nav-logo .logo-gradient {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 8px;
  list-style: none;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(15, 11, 26, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 20px;
    gap: 4px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 12px 14px;
  }
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.hero-badge span {
  color: var(--accent-green);
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.hero h1 .gradient-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- Ad Banner Zones --- */
.ad-banner {
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 24px auto;
  max-width: 728px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-banner-inline {
  margin: 30px auto;
}

/* --- Tools Grid --- */
.section-title {
  text-align: center;
  margin-bottom: 40px;
}

.section-title h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-title p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-main);
  opacity: 0;
  transition: var(--transition);
}

.tool-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.tool-card:hover::before {
  opacity: 0.05;
}

.tool-card > * {
  position: relative;
  z-index: 1;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.tool-icon.purple { background: rgba(124, 58, 237, 0.15); color: var(--accent-purple); }
.tool-icon.blue   { background: rgba(37, 99, 235, 0.15);  color: var(--accent-blue);   }
.tool-icon.cyan   { background: rgba(6, 182, 212, 0.15);  color: var(--accent-cyan);   }
.tool-icon.pink   { background: rgba(236, 72, 153, 0.15); color: var(--accent-pink);   }

.tool-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.tool-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tool-card .card-arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: var(--transition);
}

.tool-card:hover .card-arrow {
  color: var(--accent-purple);
  transform: translateX(4px);
}

/* --- Tool Page Specific --- */
.tool-page-header {
  padding: 40px 0 20px;
}

.tool-page-header .breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.tool-page-header .breadcrumb a {
  color: var(--accent-purple);
  transition: var(--transition);
}

.tool-page-header .breadcrumb a:hover {
  color: var(--text-primary);
}

.tool-page-header h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.tool-page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Tool content card */
.tool-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 30px;
}

.tool-content h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

/* --- Form Elements --- */
textarea,
input[type="text"],
input[type="number"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

textarea:focus,
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

textarea {
  resize: vertical;
  min-height: 180px;
  line-height: 1.7;
}

textarea::placeholder,
input::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6580' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-main);
  color: #fff;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(124, 58, 237, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-accent);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* --- Stats Row --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.stat-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* --- Toggle / Switch --- */
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.option-row:last-child {
  border-bottom: none;
}

.option-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-secondary);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateY(-50%) translateX(20px);
  background: #fff;
}

/* --- Range Slider --- */
.range-group {
  margin: 16px 0;
}

.range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.range-header label {
  font-size: 0.9rem;
  font-weight: 500;
}

.range-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-purple);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-input);
  border-radius: 50px;
  outline: none;
  border: 1px solid var(--border-subtle);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient-main);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient-main);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
  border: none;
}

/* --- Password Display --- */
.password-display {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  word-break: break-all;
  text-align: center;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  position: relative;
}

/* Strength Meter */
.strength-meter {
  margin-top: 12px;
}

.strength-bar {
  height: 4px;
  border-radius: 50px;
  background: var(--bg-input);
  overflow: hidden;
  margin-bottom: 6px;
}

.strength-fill {
  height: 100%;
  border-radius: 50px;
  transition: width 0.4s ease, background 0.4s ease;
  width: 0%;
}

.strength-text {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: right;
}

/* --- Converter Layout --- */
.converter-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.converter-field {
  flex: 1;
}

.converter-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.converter-field .input-row {
  display: flex;
  gap: 10px;
}

.converter-field input[type="number"] {
  flex: 2;
}

.converter-field select {
  flex: 1;
  min-width: 120px;
}

.swap-btn {
  align-self: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.swap-btn:hover {
  background: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-purple);
  transform: rotate(180deg);
}

/* Category tabs */
.category-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.category-tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.category-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.category-tab.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #fff;
}

/* --- Lorem Output --- */
.lorem-output {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  min-height: 200px;
  line-height: 1.8;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 16px;
  white-space: pre-wrap;
}

/* --- Copied Toast --- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent-green);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* --- Footer --- */
.footer {
  margin-top: auto;
  padding: 40px 0 24px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer a {
  color: var(--accent-purple);
  transition: var(--transition);
}

.footer a:hover {
  color: var(--text-primary);
}

/* --- Animations --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }

/* --- Responsive Utilities --- */
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .tool-content { padding: 20px 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .converter-field .input-row { flex-direction: column; }
  .btn-group { flex-direction: column; }
  .btn-group .btn { width: 100%; }
}
