/* ==================================================
   DEPRECATED LEGACY UI SYSTEM
   Not used by active production pages.
   Preserved temporarily for compatibility/reference.
   New development should use:
   - base.css
   - menu.css
   - tools.css
   Optional product extensions live in:
   - assets/css/core/*
================================================== */

/* =========================================
MetricLab UI System v2
Tokens + Components + Interactions
========================================= */

/* ---------- LIGHT (default) ---------- */
:root {
  --bg: var(--ml-bg, #fff);
  --surface: var(--ml-surface, #fff);
  --surface-2: var(--ml-surface-alt, #f8fafc);

  --text: var(--ml-text, #0f172a);
  --muted: var(--ml-text-muted, #64748b);

  --border: var(--border-strong, #e2e8f0);

  --primary: var(--ml-primary, #2563eb);
  --primary-hover: var(--ml-primary-hover, #1d4ed8);

  --danger: #dc2626;
  --danger-hover: #b91c1c;

  --secondary-bg: var(--ml-surface-alt, #f1f5f9);
  --secondary-border: var(--border-strong, #cbd5e1);

  --radius: var(--radius-md, 10px);
  --shadow: var(--shadow-card, 0 2px 10px rgb(0 0 0 / 0.08));

  --transition: var(--transition-default, 0.18s ease);
}

/* ---------- DARK ---------- */
[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #0f172a;
  --surface-2: #111827;

  --text: #e5e7eb;
  --muted: #9ca3af;

  --border: #1f2937;

  --primary: #3b82f6;
  --primary-hover: #2563eb;

  --danger: #ef4444;
  --danger-hover: #dc2626;

  --secondary-bg: #111827;
  --secondary-border: #374151;

  --shadow: var(--shadow-card, 0 4px 16px rgb(0 0 0 / 0.35));
}

/* =========================================
BASE
========================================= */

body {
  background: var(--bg);
  color: var(--text);
}

/* =========================================
HEADER
========================================= */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: var(--container-wide, 1100px);
  margin: 0 auto;
  padding: 0.625rem var(--space-md, 1rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 700;
  font-size: 1rem;
}

/* nav */
.nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: var(--space-md, 1rem);
  transition: var(--transition);
}

.nav a:hover {
  color: var(--text);
}

/* =========================================
DROPDOWNS
========================================= */

.dropdown a,
.menu a,
.nav-dropdown a {
  transition:
    background var(--transition-fast, 0.15s ease),
    transform var(--transition-fast, 0.15s ease);
}

.dropdown a:hover,
.menu a:hover,
.nav-dropdown a:hover {
  background: rgb(59 130 246 / 0.12);
  transform: translateX(2px);
}

.dropdown a.active,
.menu a.active,
.nav-dropdown a.active {
  background: rgb(59 130 246 / 0.18);
  border-left: 3px solid var(--primary);
}

.dropdown,
.menu,
.nav-dropdown {
  animation: dropdown-in var(--transition-default, 0.18s ease);
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =========================================
FOOTER
========================================= */

.site-footer {
  margin-top: var(--space-xl, 2.5rem);
  padding: var(--space-lg, 1.5rem) var(--space-md, 1rem);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: var(--text-sm, 0.9rem);
  color: var(--muted);
}

/* =========================================
BUTTONS
========================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs, 0.5rem);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-weight: var(--weight-semibold, 600);
  font-size: var(--text-sm, 0.95rem);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform var(--transition),
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition);
}

/* primary */
.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* secondary */
.btn-secondary {
  background: var(--secondary-bg);
  border: 1px solid var(--secondary-border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-2);
}

/* danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
  transform: translateY(-1px);
}

/* focus */
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* =========================================
TAB / CATEGORY STATES
========================================= */

.tab-btn,
.category-btn,
.mode-btn,
.emoji-tab {
  background: var(--secondary-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.tab-btn:hover,
.category-btn:hover,
.mode-btn:hover,
.emoji-tab:hover {
  background: rgb(59 130 246 / 0.12);
}

.tab-btn.active,
.category-btn.active,
.mode-btn.active,
.emoji-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* =========================================
CARDS
========================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md, 1rem);
  box-shadow: var(--shadow);
  transition:
    border-color var(--transition),
    transform var(--transition);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg, 0 8px 24px rgb(0 0 0 / 0.25));
}

/* =========================================
MICRO-INTERACTIONS
========================================= */

.skeleton {
  background: linear-gradient(
    90deg,
    #1f2937 25%,
    #374151 37%,
    #1f2937 63%
  );
  background-size: 400% 100%;
  animation: skeleton 1.2s ease infinite;
  border-radius: var(--radius-sm, 6px);
}

@keyframes skeleton {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: 0 0;
  }
}

/* =========================================
LAYOUT
========================================= */

.container {
  max-width: var(--container-wide, 1100px);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.stack > * + * {
  margin-top: var(--space-md);
}

/* =========================================
INPUT
========================================= */

.input {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.input:focus {
  border-color: var(--primary);
  outline: none;
}

/* =========================================
THEME TOGGLE (OPTIONAL BUTTON)
========================================= */

.theme-toggle {
  cursor: pointer;
}
