/* ═══════════════════════════════════════════════════════════════════════════
   UniToolx — Unified Design System
   Professional, responsive, mobile-first — v2.0
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Colors — Cohesive dark palette */
  --bg: #080b12;
  --bg-elevated: #0d1117;
  --bg-secondary: #0f172a;
  --panel: #111827;
  --panel-hover: #1a2332;
  --panel2: #0f172a;

  /* Text hierarchy */
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #64748b;

  /* Brand — Vibrant green */
  --brand: #22c55e;
  --brand-light: #4ade80;
  --brand-dark: #16a34a;
  --brand-glow: rgba(34, 197, 94, 0.4);

  /* Accents */
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;

  /* Borders & Glass */
  --border: rgba(148, 163, 184, 0.12);
  --border-hover: rgba(148, 163, 184, 0.2);
  --glass: rgba(17, 24, 39, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--brand-glow);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing (4px grid) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Focus */
  --focus: rgba(59, 130, 246, 0.45);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Subtle gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(34, 197, 94, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 10%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); }
h2 { font-size: clamp(1.375rem, 3vw, 2rem); }
h3 { font-size: clamp(1.0625rem, 2vw, 1.375rem); }

p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.small {
  font-size: 0.8125rem;
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover { color: var(--brand); }

img, svg, video { max-width: 100%; height: auto; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: var(--space-md);
}

@media (min-width: 640px) {
  .container { padding: var(--space-lg); }
}

/* ── Navigation ─────────────────────────────────────────────────────────── */
.nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  animation: fadeSlideDown 0.6s var(--ease-out) both;
}

.nav > div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
}

.nav .brand { justify-self: start; }
.coffee-center { justify-self: center; }

.nav .lang {
  width: auto;
  min-width: 140px;
  max-width: 220px;
  padding: 10px 12px;
}

.nav .badge { white-space: nowrap; }

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform var(--duration-normal) var(--ease-out);
}

.brand:hover {
  transform: scale(1.02);
  color: var(--text);
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--brand);
  box-shadow: 0 0 12px var(--brand-glow);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 12px var(--brand-glow); }
  50% { box-shadow: 0 0 20px var(--brand-glow), 0 0 30px rgba(34, 197, 94, 0.2); }
}

/* Coffee center button */
.coffee-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(8px);
  text-decoration: none;
  color: var(--text);
  transition: all var(--duration-normal) var(--ease-out);
}

.coffee-center:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* ── Badge ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--muted);
  background: var(--glass);
  backdrop-filter: blur(8px);
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
}

.badge:hover {
  border-color: var(--border-hover);
  color: var(--text);
  transform: translateY(-1px);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
input[type="search"],
input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--duration-normal) var(--ease-out);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
  background: rgba(15, 23, 42, 0.8);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4h-7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: var(--space-xs);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

button::before,
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

button:hover,
.btn:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 4px 20px rgba(34, 197, 94, 0.2);
}

button:hover::before,
.btn:hover::before { opacity: 1; }

button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Button variants */
.btn.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-color: var(--brand);
  color: #000;
  font-weight: 700;
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand) 100%);
  box-shadow: var(--shadow-glow);
}

.btn.secondary {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
}

.btn.secondary:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-md), 0 4px 20px rgba(99, 102, 241, 0.2);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
}

.btn.ghost:hover {
  background: var(--glass);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.btn.mini {
  padding: 8px 14px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

/* ── Cards & Panels ─────────────────────────────────────────────────────── */
.panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  transition: all var(--duration-normal) var(--ease-out);
}

.card {
  display: block;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.8) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  min-height: 160px;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.card:hover {
  border-color: rgba(34, 197, 94, 0.3);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 8px 32px rgba(34, 197, 94, 0.1);
}

.card:hover::before { opacity: 1; }

.card h3 {
  margin: 0 0 var(--space-sm);
  font-size: 1.125rem;
  position: relative;
}

.card p {
  margin: 0 0 var(--space-md);
  font-size: 0.875rem;
  position: relative;
}

/* ── Grid System ────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.grid > * { grid-column: span 12; }

@media (min-width: 640px) {
  .grid > * { grid-column: span 6; }
}

@media (min-width: 900px) {
  .grid > * { grid-column: span 4; }
}

/* ── Flex Utilities ─────────────────────────────────────────────────────── */
.row {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.col {
  flex: 1;
  min-width: 260px;
}

@media (max-width: 639px) {
  .col { min-width: 100%; }
}

/* ── Dividers ───────────────────────────────────────────────────────────── */
.hr {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: var(--space-lg) 0;
  border: none;
}

/* ── QR Box ─────────────────────────────────────────────────────────────── */
.qrbox {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: var(--space-lg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.4);
  transition: all var(--duration-normal) var(--ease-out);
}

.qrbox:has(img) {
  border-style: solid;
  border-color: var(--glass-border);
}

/* ── Keyboard shortcuts ─────────────────────────────────────────────────── */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 0 var(--border);
}

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.animate-stagger > * {
  animation: fadeSlideUp 0.5s var(--ease-out) both;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.2s; }
.animate-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.animate-stagger > *:nth-child(6) { animation-delay: 0.3s; }

/* ── RTL Support ────────────────────────────────────────────────────────── */
html[dir="rtl"] { direction: rtl; }

html[dir="rtl"] select {
  background-position: left 12px center;
  padding-left: 40px;
  padding-right: 16px;
}

html[dir="rtl"] .topbar,
html[dir="rtl"] .tools-head,
html[dir="rtl"] .hero2-cta,
html[dir="rtl"] .footer2-row,
html[dir="rtl"] .nav {
  direction: rtl;
}

html[dir="rtl"] .preview-row:hover {
  transform: translateX(-4px);
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Firefox scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border) var(--bg); }

/* ── Selection & Focus ──────────────────────────────────────────────────── */
::selection { background: rgba(34, 197, 94, 0.3); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible {
  outline-offset: 3px;
}

/* ── Navigation responsive ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
  }

  .nav .brand {
    flex: 1 1 auto;
    min-width: 0;
    order: 0;
  }

  .coffee-center {
    flex-shrink: 0;
    order: 1;
  }

  .nav > div {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
    justify-content: flex-start;
    order: 10;
  }

  .nav .lang { flex: 1 1 0; min-width: 120px; max-width: none; }
  .badge { padding: 6px 10px; }
}

@media (max-width: 420px) {
  .badge { font-size: 0.72rem; padding: 5px 8px; }
  .nav .lang { padding: 8px 28px 8px 10px; font-size: 0.8125rem; }
  .nav .brand { font-size: 1rem; }
}

/* ── Compact panels on small screens ────────────────────────────────────── */
@media (max-width: 420px) {
  .panel { padding: var(--space-md); }
  .card { padding: var(--space-md); }
}

/* ── Reduced Motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  body { background: #fff !important; color: #111 !important; }
  body::before { display: none; }
  .card, .panel { background: #fff !important; border-color: #ddd !important; box-shadow: none !important; }
  .btn { display: none !important; }
}
