:root {
  --bs-border-radius: 0.625rem;
  --bs-border-radius-lg: 1.5rem;

  /* —— MTSBU palette (mtsbu.ua) —— */
  /* Neutral shades */
  --shades-50: #f7f9fa;
  --shades-150: #e8ebed;
  --shades-200: #dcdee0;
  --shades-250: #bec1c4;
  --shades-300: #999c9e;
  --shades-400: #717375;
  --shades-600: #1f2021;
  /* Status */
  --danger-500: #f80000;   /* MTSBU logo red */
  --success-500: #00a942;  /* MTSBU brand green */
  /* Brand green (logo) — primary action / accent scale */
  --primary-50: #ebf3ed;   /* MTSBU header mint */
  --primary-100: #d3ecdc;
  --primary-400: #33c06a;
  --primary-500: #00a942;  /* core brand green */
  --primary-600: #008236;  /* darker green (button bg / hover, AA contrast) */
  --ink: #1a1a1a;          /* near-black (MTSBU button base) */
  --white: #ffffff;
  --default-border-radius: 1.5rem;
  /* MTSBU accent gradient: turquoise → yellow */
  --default-gradient: linear-gradient(90deg, #44f6ce 0%, #f8f38a 100%);

  /* App layout (non-color) */
  --logo-filter: none;
  --font-family: 'e-Ukraine', 'Onest', sans-serif;
  /* 1rem = current html scale (0.875rem mobile ≈14px, 1.125rem desktop ≈18px at 16px UA default) */
  --font-size-base: 1rem;
  --chat-round-btn-size: 2.5rem;
}

/* —— e-Ukraine: official Ukrainian state font used by mtsbu.ua —— */
@font-face {
  font-family: 'e-Ukraine';
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  src: url('../resources/e-Ukraine-Light.otf') format('opentype');
}
@font-face {
  font-family: 'e-Ukraine';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../resources/e-Ukraine-Regular.otf') format('opentype');
}
@font-face {
  font-family: 'e-Ukraine';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../resources/e-Ukraine-Medium.otf') format('opentype');
}
@font-face {
  font-family: 'e-Ukraine';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('../resources/e-Ukraine-Bold.otf') format('opentype');
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* —— Heroicons (inline SVG, replaces Font Awesome) —— */
.hicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.hicon svg,
svg.hicon-svg {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

.hicon-spin svg,
svg[data-spin="true"] {
  animation: hicon-spin 1s linear infinite;
}

@keyframes hicon-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Inline icon spacing (legacy me-* utility classes, no Bootstrap loaded) */
.hicon.me-1 {
  margin-right: 0.25rem;
}

.hicon.me-2 {
  margin-right: 0.5rem;
}

html {
  height: 100%;
  min-height: 100%;
  font-family: var(--font-family);
}

button,
input,
textarea,
select,
optgroup {
  font-family: inherit;
}

body {
  background: var(--shades-50);
  min-height: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-size: var(--font-size-base);
  color: var(--shades-600);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  transition: background-color 0.3s, color 0.3s;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* —— App shell: fixed-width sidebar + fluid main column (ChatGPT-style) —— */
#main-app.app-shell {
  --sidebar-width: 320px;
  --sidebar-rail-width: 4rem;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* —— Non-sidebar pages (KB upload, category/file status) —— */
/* Constrain #main-app to the viewport so its .content-area scrolls instead of
   overflowing under the body's overflow:hidden (the .app-shell chat page sets
   its own grid height and is excluded here). */
#main-app:not(.app-shell) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Main column that holds the nav tabs + scrolling content area. The chat page
   (index.html) loads styles.css which restates this with extra variables; pages
   that don't load styles.css (KB upload, category status) rely on this base rule
   so the .content-area below can scroll instead of overflowing the viewport. */
.chat-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
}

.logo {
  display: none;
}

.main-title {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--shades-600);
  text-align: center;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem 0 0.75rem 0;
}

.subtitle {
  font-size: 1rem;
  font-weight: 300;
  color: var(--shades-400);
  text-align: center;
  margin-bottom: 1rem;
}

/* —— Cards (form-block / default-info-card) —— */
.ui-card,
.login-card,
.csat-card,
.csat-modal,
.category-selection-card,
.clarifying-question-card,
.copy-toast,
.modal-content {
  background: var(--white);
  border: none;
  border-radius: var(--default-border-radius);
  box-shadow: 0 1rem 2.5rem rgba(61, 62, 64, 0.08);
}

/* —— Buttons: filled (black → gradient hover) + outline (dark border) —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  min-height: 2.5rem;
  border: 0.1875rem solid transparent;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition: border-color 0.35s ease, background-color 0.35s ease, color 0.35s ease, filter 0.35s ease;
}

.btn-filled {
  border: none;
  background-color: var(--ink);
  background-image: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  color: var(--white);
  border-radius: 0.75rem;
}

/* MTSBU signature: black → turquoise-yellow gradient on hover with dark text */
.btn-filled:hover:not(:disabled),
.btn-filled:focus-visible:not(:disabled) {
  background-color: var(--ink);
  background-image: var(--default-gradient);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  color: var(--ink);
}

.btn-filled:disabled {
  background-color: var(--shades-400);
  background-image: none;
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
}

.btn-outline {
  background: transparent;
  color: var(--shades-600);
  border: 0.0625rem solid var(--shades-600);
  border-radius: 0.75rem;
  padding: 0.9375rem 1.5rem;
  min-width: 9.375rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.286;
  transition: all 0.35s ease-in-out;
}

.btn-outline:hover:not(:disabled) {
  background: var(--shades-600);
  color: var(--white);
}

.btn-outline.refresh-btn:hover:not(:disabled) .refresh-btn__icon,
.btn-outline.refresh-btn:focus-visible:not(:disabled) .refresh-btn__icon {
  filter: brightness(0) invert(1);
}

.btn-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  padding: 0.75rem;
  min-width: 2.5rem;
}

.btn-round {
  width: var(--chat-round-btn-size);
  height: var(--chat-round-btn-size);
  min-width: var(--chat-round-btn-size);
  min-height: var(--chat-round-btn-size);
  padding: 0;
  border-radius: 50%;
}

.btn-outline.btn-icon {
  min-width: auto;
  padding: 0.75rem;
}

.btn-outline.btn-round,
.btn-filled.btn-round {
  min-width: var(--chat-round-btn-size);
  padding: 0;
  border-radius: 50%;
}

.btn-sm {
  padding: 0.8125rem 0.9375rem;
  min-height: auto;
  font-size: 0.875rem;
  line-height: 1.375;
}

.btn-outline.btn-sm {
  min-width: auto;
}

.btn-block {
  width: 100%;
}

/* Text inputs / search field */
.ui-input,
.form-control {
  padding: 0.875rem 1.1875rem;
  border: 0.0625rem solid #e5e5e5;
  border-radius: 2.5rem;
  color: var(--shades-600);
  background: transparent;
  box-shadow: none;
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.375;
  transition: border-color 0.35s ease-in-out, color 0.35s ease-in-out;
}

.csat-feedback textarea,
.category-clarification textarea {
  padding: 0.875rem 1.1875rem;
  border: 0.0625rem solid #e5e5e5;
  border-radius: 1rem;
  color: var(--shades-600);
  background: transparent;
  box-shadow: none;
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.375;
  transition: border-color 0.35s ease-in-out;
}

.ui-input::placeholder,
.form-control::placeholder,
.csat-feedback textarea::placeholder,
.category-clarification textarea::placeholder {
  color: #aaaaaa;
}

.ui-input:focus,
.form-control:focus,
.csat-feedback textarea:focus,
.category-clarification textarea:focus {
  outline: none;
  border-color: var(--shades-600);
  box-shadow: none;
  background: transparent;
}

/* MTSBU light header: pale mint bar with dark tabs */
.nav-tabs {
  background-color: var(--primary-50);
  border-bottom: 0.0625rem solid var(--shades-150);
  display: flex;
  gap: 0;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

.nav-tabs__logo {
  display: flex;
  align-items: center;
  padding: 0.625rem 1.25rem;
  flex: 0 0 auto;
}

.nav-tabs__logo img {
  height: 2rem;
  width: auto;
  display: block;
}

.nav-tabs > * {
  flex: 0 0 auto;
}

.nav-tabs-selectors {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-left: auto;
  align-self: stretch;
  height: 100%;
}

.nav-tabs .nav-tabs-selectors .localization-dropdown.--dropdown {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  height: 100%;
}

.nav-tab {
  padding: 0.9375rem 1.5625rem;
  background: transparent;
  border: none;
  border-bottom: 0.1875rem solid transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--shades-400);
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--shades-600);
  background: color-mix(in srgb, var(--primary-500) 8%, transparent);
}

.nav-tab.active {
  color: var(--shades-600);
  background: color-mix(in srgb, var(--primary-500) 10%, transparent);
  border-bottom-color: var(--primary-500);
}

.content-area {
  padding: 1rem 1rem 0rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

/* Custom scrollbar styling */
::-webkit-scrollbar {
  width: 0.5rem;
  height: 0.5rem;
}

::-webkit-scrollbar-track {
  background: var(--primary-50);
  border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb {
  background: var(--shades-200);
  border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-500);
}

/* Localization dropdown */

.localization-dropdown.--dropdown {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: 100%;
}

.localization-dropdown.--dropdown,
.localization-dropdown.--dropdown * {
  line-height: 120%;
}

.localization-dropdown.--dropdown .language-button.--dropdown__value {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  user-select: none;
  cursor: pointer;
}

.localization-dropdown__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  min-width: 1rem;
  aspect-ratio: 1 / 1;
  margin-right: 0.5rem;
  color: inherit;
}

.localization-dropdown__icon .hicon {
  font-size: 1rem;
  color: inherit;
}

.localization-dropdown__icon-img {
  display: block;
  width: 1rem;
  height: 1rem;
}

.nav-tabs .localization-dropdown__icon-img {
  filter: none;
  opacity: 0.72;
}

.nav-tabs .language-button:hover .localization-dropdown__icon-img {
  opacity: 1;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-outline.refresh-btn {
  padding: 0.5rem 0.875rem;
  min-width: auto;
  min-height: auto;
  border-radius: 999px;
  line-height: 1.25;
  font-weight: 500;
}

.refresh-btn__icon {
  display: block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  transition: filter 0.35s ease-in-out;
}

.localization-dropdown__label {
  flex: 0 1 auto;
  min-width: 0;
  text-align: left;
}

.localization-dropdown__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  color: inherit;
  transition: transform 0.4s ease;
}

.localization-dropdown__arrow .hicon {
  font-size: 0.625rem;
  color: inherit;
  transition: transform 0.4s ease;
}

.localization-dropdown.-active .localization-dropdown__arrow {
  transform: rotate(180deg);
}

.localization-dropdown.--dropdown .language-dropdown.--dropdown__list {
  position: fixed;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.625rem;
  margin: 0;
  padding: 1rem;
  min-width: 10rem;
  width: max-content;
  max-width: min(20rem, calc(100vw - 1.5rem));
  background-color: var(--white);
  border-radius: 0.5rem;
  filter: drop-shadow(0 0.5rem 1rem rgba(61, 62, 64, 0.3));
  border: none;
  box-shadow: none;
  z-index: 10002;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease;
  overflow: visible;
}

.localization-dropdown.--dropdown .language-dropdown.--dropdown__list::before {
  content: '';
  position: absolute;
  top: -0.3125rem;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 0.625rem;
  height: 0.625rem;
  background-color: var(--white);
  pointer-events: none;
  z-index: 0;
}

.localization-dropdown.--dropdown.-active .language-dropdown.--dropdown__list {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.localization-dropdown.--dropdown .language-option.--dropdown__list-item {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0.25rem 0;
  margin: 0;
  background: transparent;
  text-align: left;
  transition: color 0.4s ease;
}

/* Language Selector Styles */
#languageSelectorContainer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

/* When inside nav-tabs, style like nav-tab but with accent color */
.nav-tabs .language-button {
  padding: 0.9375rem 1.5625rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--shades-400);
  transition: all 0.2s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  align-self: stretch;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
}

.nav-tabs .language-button:hover {
  color: var(--shades-600);
  background: color-mix(in srgb, var(--primary-500) 8%, transparent);
}

.nav-tabs .language-button .hicon {
  color: var(--shades-400);
}

.nav-tabs .language-button:hover .hicon {
  color: var(--shades-600);
}

/* Make dropdown overlay, not expand navbar */
.nav-tabs #languageSelectorContainer {
  position: relative;
}

.nav-tabs .language-dropdown {
  position: fixed !important;
  z-index: 10002;
  top: unset;
  right: unset;
  left: unset;
}

/* Standalone language selector (for login page) */
.language-button {
  background: color-mix(in srgb, var(--white) 20%, transparent);
  color: var(--white);
  border: 0.0625rem solid color-mix(in srgb, var(--white) 30%, transparent);
  padding: 0.5rem 1rem;
  border-radius: var(--bs-border-radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(0.625rem);
}

.language-button:hover {
  background: color-mix(in srgb, var(--white) 30%, transparent);
  border-color: color-mix(in srgb, var(--white) 50%, transparent);
}

.language-option {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--shades-250);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: color 0.2s ease;
}

.language-option:hover {
  color: var(--shades-600);
}

.language-option.active {
  color: var(--shades-600);
}

.language-option .hicon {
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.language-option.active .hicon {
  opacity: 1;
}

/* Animation for smooth transitions */
#main-app, #login-overlay {
  transition: opacity 0.3s ease-in-out;
}

/* Footer Styles — sits under the input area inside the main column */
.site-footer {
  width: 100%;
  text-align: center;
  padding: 0.5rem 1rem 0.25rem;
  background: transparent;
  color: var(--shades-300);
  font-size: 0.75rem;
}

.site-footer p {
  margin: 0;
  padding: 0;
}

@media (max-width: 768px) {
  .nav-tab {
    white-space: nowrap;
  }

  .language-dropdown {
    min-width: 8.75rem;
  }

  .language-option {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
  }

  .main-title {
    font-size: 1rem;
  }

  .title-container {
    /* Leave enough room on both sides so centered logo+title clears the fixed auth button */
    padding: 0.5rem 4rem 0.5rem 4rem;
    gap: 0.5rem;
  }

  .title-container .logo {
    display: none;
  }

  .site-footer {
    font-size: 0.75rem;
    padding: 0.625rem;
  }

  /* Push subtitle text away from the fixed auth button (top-left, right-edge ~4.375rem).
     Symmetric padding keeps the text visually centred. */
  .subtitle {
    font-size: 0.875rem;
    padding-left: 4rem;
    padding-right: 4rem;
  }

}
