﻿:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg-page: #edf2f9;
  --bg-page-accent: radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 36%), radial-gradient(circle at top right, rgba(16, 185, 129, 0.14), transparent 30%), linear-gradient(180deg, #f8fbff 0%, #edf2f9 48%, #e7edf7 100%);
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-strong: #ffffff;
  --bg-soft: #f8fafc;
  --bg-soft-2: #eef2ff;
  --text-main: #0f172a;
  --text-sub: #64748b;
  --border-color: rgba(148, 163, 184, 0.25);
  --border-strong: rgba(148, 163, 184, 0.4);
  --shadow-lg: 0 28px 80px rgba(15, 23, 42, 0.12);
  --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --overlay: rgba(15, 23, 42, 0.62);
  --layout-width: 1160px;
  --layout-gutter: 16px;
  --floating-desktop-space: 210px;
  --floating-top: 24px;
}

:root[data-theme='dark'] {
  --primary: #60a5fa;
  --primary-hover: #3b82f6;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --bg-page: #020817;
  --bg-page-accent: radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), transparent 34%), radial-gradient(circle at top right, rgba(52, 211, 153, 0.14), transparent 26%), linear-gradient(180deg, #08111f 0%, #040b16 46%, #020817 100%);
  --bg-card: rgba(10, 17, 30, 0.82);
  --bg-card-strong: #0f172a;
  --bg-soft: #111827;
  --bg-soft-2: #172036;
  --text-main: #e5eefb;
  --text-sub: #94a3b8;
  --border-color: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.24);
  --shadow-lg: 0 30px 90px rgba(2, 6, 23, 0.45);
  --shadow-md: 0 18px 44px rgba(2, 6, 23, 0.34);
  --overlay: rgba(2, 6, 23, 0.78);
}

html {
  color-scheme: light;
}

html[data-theme='dark'] {
  color-scheme: dark;
}

html,
body,
.navbar,
.guide-card,
.action-card,
.query-container,
.modal,
.btn,
.input-field,
.nav-item,
.toolbar-btn,
.step-dot,
.alert,
.stat-item,
.result-table tbody tr {
  transition: background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}

.navbar {
  position: relative;
  top: auto;
  z-index: 20;
  display: grid;
  grid-template-columns: var(--floating-desktop-space) auto 1fr var(--floating-desktop-space);
  align-items: center;
  gap: 20px;
  width: min(var(--layout-width), calc(100% - 32px));
  margin: 16px auto 0;
  padding: 18px 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.navbar::after {
  content: '';
  grid-column: 4;
  display: block;
  width: 100%;
  min-height: 1px;
}

.brand {
  grid-column: 2;
}

.nav-actions {
  grid-column: 3;
  justify-self: center;
}

.nav-tabs {
  justify-content: center;
}

.product-floating-controls {
  position: fixed;
  top: max(var(--floating-top), calc(env(safe-area-inset-top) + 12px));
  left: max(var(--layout-gutter), calc((100vw - var(--layout-width)) / 2 + 24px));
  z-index: 140;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.floating-controls {
  position: fixed;
  top: max(var(--floating-top), calc(env(safe-area-inset-top) + 12px));
  right: max(var(--layout-gutter), calc((100vw - var(--layout-width)) / 2 + 24px));
  z-index: 140;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-card-strong) 88%, transparent);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

.product-toolbar-actions {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px;
  border-radius: 22px;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 84px;
  padding: 8px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.floating-controls > .toolbar-btn,
.toolbar-actions .toolbar-btn {
  flex: 0 0 auto;
}

.toolbar-btn:hover {
  color: var(--text-main);
  background: color-mix(in srgb, var(--primary) 10%, var(--bg-card-strong));
}

.toolbar-btn i {
  font-size: 13px;
}

.product-switch-btn {
  width: 100%;
  min-width: 92px;
  text-decoration: none;
}

.history-btn {
  width: 100%;
  min-width: 0;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--bg-card-strong) 88%, transparent);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

#languageToggleBtn {
  min-width: 72px;
}

#themeToggleBtn {
  min-width: 76px;
}

@media (max-width: 1200px) {
  .navbar {
    grid-template-columns: 190px auto 1fr 190px;
  }

  .product-floating-controls {
    left: 16px;
  }

  .floating-controls {
    right: 16px;
  }
}

@media (max-width: 980px) {
  .navbar {
    display: flex;
    width: min(100%, calc(100% - 20px));
    margin: 12px auto 0;
    padding: 16px 18px;
  }

  .navbar::after {
    content: none;
  }

  .nav-actions {
    justify-self: auto;
  }

  .product-floating-controls {
    top: max(12px, calc(env(safe-area-inset-top) + 8px));
    left: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .floating-controls {
    top: max(12px, calc(env(safe-area-inset-top) + 8px));
    right: 12px;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

  .history-btn {
    width: 100%;
    padding: 7px 10px;
    font-size: 11px;
  }

  .toolbar-actions {
    gap: 4px;
    padding: 4px;
    border-radius: 18px;
  }

  .toolbar-actions .toolbar-btn {
    min-width: 56px;
    padding: 7px 9px;
    gap: 5px;
    font-size: 11px;
    border-radius: 14px;
  }

  .toolbar-actions .toolbar-btn i,
  .history-btn i {
    font-size: 12px;
  }

  #languageToggleBtn,
  #themeToggleBtn {
    min-width: 58px;
  }
}

@media (max-width: 480px) {
  .floating-controls {
    top: max(10px, calc(env(safe-area-inset-top) + 6px));
    right: 10px;
    gap: 5px;
  }

  .history-btn {
    padding: 6px 9px;
    font-size: 10px;
  }

  .toolbar-actions .toolbar-btn {
    min-width: 52px;
    padding: 6px 8px;
  }
}



