/* ==========================================================================
   Top navbar: brand, search box, language, storage meter, user menu.
   Owning feature: app chrome
   Load order is defined in Views/Shared/_CssIncludes.cshtml — do not reorder.
   ========================================================================== */

/* --- Top navbar --------------------------------------------------------- */
.fh-navbar {
  background: #fff;
  border-bottom: 1px solid var(--fh-border);
}
.fh-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}

/* Hamburger. A real <button>, so it is focusable and Enter/Space-activated
   for free; the reset below just strips the UA chrome a <button> brings.
   display is width-gated: an unconditional `display: inline-flex` here
   would override the ≥992px `display: none` in the shell block above
   (same specificity, later source order) and re-show a dead control on
   every laptop/desktop/4K viewport. */
.fh-burger {
  align-items: center; justify-content: center;
  background: none; border: 0; appearance: none;
  color: var(--fh-muted); border-radius: 0.625rem; padding: 0.5rem 0.6rem;
  width: 2.5rem; height: 2.5rem;
  line-height: var(--fh-leading-none); cursor: pointer;
}
@media (max-width: 991.98px) {
  .fh-burger { display: inline-flex; }
}
@media (min-width: 992px) {
  .fh-burger,
  .fh-backdrop {
    display: none;
  }
}
.fh-burger:hover { background: var(--fh-soft); color: var(--fh-text); }
.fh-burger:focus-visible {
  outline: 2px solid var(--fh-primary);
  outline-offset: 2px;
}

.fh-brand { display: flex; align-items: center; }
.fh-brand a { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; }
.fh-brand-mark {
  width: 1.875rem; height: 1.875rem; border-radius: 0.625rem;
  background: var(--fh-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: var(--fh-text-sm);
}
.fh-brand-text {
  color: var(--fh-text);
  font-weight: var(--fh-weight-semibold);
  font-size: var(--fh-text-2xl);
  letter-spacing: var(--fh-tracking-tighter);
  line-height: var(--fh-leading-tight);
}
.fh-brand-logo {
  height: 1.75rem;
  width: auto;
  max-width: 7rem;
  object-fit: contain;
}
.fh-brand-badge {
  font-size: var(--fh-text-xs); color: var(--fh-muted); background: var(--fh-soft);
  padding: 2px 6px; border-radius: 0.25rem; letter-spacing: var(--fh-tracking-wide);
}

/* Grows with the navbar instead of stopping dead at 560px, which on a 3440px
   ultra-wide left the search box as a small island in a very empty header.
   min-width:0 (also set further down) lets it shrink below its content so the
   brand + action cluster can never force the header past the viewport.
   Below 1440 the cap stays 40rem; from 1440 it can grow with the chrome. */
.fh-search { flex: 1 1 auto; max-width: 40rem; margin: 0; position: relative; min-width: 0; }
@media (min-width: 1440px) and (max-width: 1919.98px) {
  .fh-search { max-width: clamp(28rem, 32vw, 48rem); }
}
@media (min-width: 1920px) and (max-width: 2559.98px) {
  .fh-search { max-width: clamp(32rem, 36vw, 56rem); }
}
@media (min-width: 2560px) and (max-width: 3839.98px) {
  .fh-search { max-width: clamp(36rem, 40vw, 64rem); }
}
@media (min-width: 3840px) {
  .fh-search { max-width: clamp(40rem, 42vw, 72rem); }
}
.fh-search-box {
  display: flex; align-items: center; gap: 0.625rem;
  background: #f7f8fa;
  border: 1px solid var(--fh-border);
  border-radius: 0.75rem;
  height: 2.75rem;
  padding: 0 0.5rem 0 1rem;
  overflow: visible;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
@media (min-width: 2560px) and (max-width: 3839.98px) {
  .fh-search-box { height: 3rem; }
}
@media (min-width: 3840px) {
  .fh-search-box { height: 3.15rem; }
}
.fh-search-box:focus-within {
  background: #fff;
  border-color: #c7ccd6;
  box-shadow: 0 1px 4px rgba(20, 22, 26, 0.06);
}
.fh-search-icon { color: var(--fh-muted); margin: 0; font-size: var(--fh-text-md); }
.fh-search-input {
  flex: 1; border: 0; background: transparent; padding: 0 0.25rem;
  min-width: 0;
  font-size: var(--fh-text-base); color: var(--fh-text); outline: none;
}

/* Live search suggestions (P1-4) / history (P2-7) dropdown under the global
   search box. Positioned by JS-inserted markup, styled here. */
.fh-search-suggest {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.35rem;
  z-index: 1050;
  border: 1px solid var(--fh-border, #e2e8f0);
  border-radius: 0.65rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  background: #fff;
}
.fh-search-suggest.show { display: block; }
.fh-search-suggest-item {
  border-radius: 0.375rem;
  padding: 0.45rem 0.65rem;
  font-size: var(--fh-text-base);
  color: var(--fh-text, #1e293b);
  transition: background-color 0.12s ease;
}
.fh-search-suggest-item.active,
.fh-search-suggest-item:hover {
  background-color: var(--fh-primary-soft, #eff6ff);
  color: var(--fh-primary, #2563eb);
}
.fh-search-suggest-item i { width: 1.1em; }

/* History rows: each suggestion item is a flex row with an anchor (flex: 1)
   plus a per-term remove icon button, and a full-width clear-all footer. */
.fh-search-suggest-item-wrap {
  display: flex;
  align-items: center;
}
.fh-search-suggest-item-wrap .fh-search-suggest-item {
  flex: 1;
  min-width: 0;
}
.fh-search-suggest-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-right: 0.25rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--fh-muted, #6b7280);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color var(--fh-transition-fast, 0.15s ease), color var(--fh-transition-fast, 0.15s ease);
}
.fh-search-suggest-remove:hover,
.fh-search-suggest-remove:focus-visible {
  background-color: rgba(var(--fh-danger-rgb, 220, 38, 38), 0.1);
  color: var(--fh-danger, #dc2626);
}
.fh-search-suggest-clear-history {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.45rem 0.65rem;
  border: none;
  border-top: 1px solid var(--fh-border, #e2e8f0);
  border-radius: 0.375rem;
  background: transparent;
  color: var(--fh-muted, #6b7280);
  font-size: var(--fh-text-sm);
  cursor: pointer;
  transition: background-color var(--fh-transition-fast, 0.15s ease), color var(--fh-transition-fast, 0.15s ease);
}
.fh-search-suggest-clear-history:hover,
.fh-search-suggest-clear-history:focus-visible {
  background-color: var(--fh-primary-soft, #eff6ff);
  color: var(--fh-primary, #2563eb);
}

/* Term highlighting on /Search results (P1-6) */
mark { background: #fef08a; color: inherit; padding: 0 2px; border-radius: 3px; font-weight: var(--fh-weight-semibold); }

/* Shared with Admin Permissions (Views/Shared/_PermissionsWorkspace.cshtml,
   _UserAccessResult.cshtml) — do not scope these under .fh-search-container. */
.fh-search-table {
  font-size: var(--fh-text-sm);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 0;
}

.fh-search-table thead th {
  background: #ffffff;
  color: var(--fh-muted, #6b7280);
  font-weight: var(--fh-weight-semibold);
  font-size: var(--fh-text-xs);
  text-transform: uppercase;
  letter-spacing: var(--fh-tracking-wide);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--fh-border, #e2e8f0);
  border-top: none;
  vertical-align: middle;
}

.fh-search-table tbody tr {
  transition: background-color 0.12s ease;
}

.fh-search-table tbody tr:hover td {
  background-color: var(--fh-primary-soft, #eff6ff);
}

.fh-search-table tbody td {
  padding: 0.7rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.fh-search-table tbody tr:last-child td {
  border-bottom: none;
}

/* Search (/drive/search) error + "0 results" states render through the
   shared _EmptyState component (.fh-empty--status) — see
   Views/Search/_SearchBody.cshtml. No dedicated .fh-search-empty rules. */

/* Navbar language toggle pill — segmented inline VN | US flag icons */
.fh-lang-toggle {
  display: inline-flex;
  align-items: center;
  background: #f2f3f6;
  border: 0;
  border-radius: 0.625rem;
  padding: 3px;
  height: 2rem;
  box-sizing: border-box;
}

.fh-lang-toggle form {
  margin: 0;
  display: inline-flex;
}

.fh-lang-btn {
  border: 0;
  background: transparent;
  width: 34px;
  height: 26px;
  padding: 0;
  border-radius: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  box-sizing: border-box;
}

.fh-lang-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.04);
}

.fh-lang-btn.active {
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 22, 26, 0.1);
  cursor: default;
}

.fh-lang-btn:focus-visible {
  outline: 2px solid var(--fh-primary);
  outline-offset: 1px;
}

/* Flag icon wrapper, Font Awesome and inline SVG styles */
.fh-flag-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  line-height: var(--fh-leading-none);
  font-size: var(--fh-text-lg);
  transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.fh-flag-icon i {
  display: inline-block;
  line-height: var(--fh-leading-none);
  font-size: var(--fh-text-lg);
}

.fh-flag-svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.fh-lang-btn:not(.active) .fh-flag-icon {
  opacity: 0.55;
}

.fh-lang-btn:hover:not(.active) .fh-flag-icon {
  opacity: 1;
  transform: scale(1.05);
}

.fh-lang-btn.active .fh-flag-icon {
  opacity: 1;
  filter: none;
}

/* Navbar / sidebar storage meter pill — icon, slim progress bar, "used / quota"
   label, all inline. .fh-storage-meter-bar/-fill are deliberately separate
   from _UsageBar's .fh-storage-bar (that one is a multi-segment used/trash/free
   breakdown for the Storage pages; this is a single-fraction glance). */
.fh-storage-meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--fh-border);
  border-radius: var(--bs-border-radius-pill, 50rem);
  color: var(--fh-muted);
  font-size: var(--fh-text-xs);
}
.fh-storage-meter > i { font-size: var(--fh-text-sm); }
.fh-storage-meter-bar {
  width: 70px;
  height: 5px;
  border-radius: 999px;
  background: var(--fh-soft);
  overflow: hidden;
}
.fh-storage-meter-fill {
  display: block;
  height: 100%;
  background: var(--fh-primary);
  border-radius: inherit;
}
.fh-storage-meter-over .fh-storage-meter-fill { background: var(--fh-danger); }
.fh-storage-meter-label {
  font-weight: var(--fh-weight-semibold);
  color: var(--fh-text);
  white-space: nowrap;
}
a.fh-storage-meter {
  text-decoration: none;
}
a.fh-storage-meter:hover {
  background: var(--fh-soft);
  color: var(--fh-muted);
}

.fh-user-btn {
  display: flex; align-items: center; gap: 0.625rem; border: 0; background: transparent;
  height: 2.75rem; padding: 0 0.625rem 0 0.375rem; border-radius: 0.75rem;
  text-align: left;
  transition: background-color var(--fh-transition-fast, 0.15s ease);
}
.fh-user-btn:hover,
.fh-user-btn[aria-expanded="true"] { background: #f2f3f6; }
.fh-avatar {
  width: 2rem; height: 2rem; border-radius: 0.625rem;
  background: var(--fh-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fh-text-xs); font-weight: var(--fh-weight-semibold); letter-spacing: var(--fh-tracking-wide);
}
.fh-user-name { display: block; font-size: var(--fh-text-sm); font-weight: var(--fh-weight-medium); color: var(--fh-text); line-height: var(--fh-leading-tight); }
.fh-user-role { display: block; font-size: var(--fh-text-xs); color: var(--fh-muted); line-height: var(--fh-leading-tight); }
.fh-user-btn .fh-user-role .badge {
  background: none; color: var(--fh-muted); font-weight: var(--fh-weight-medium);
  font-size: var(--fh-text-xs); padding: 0; letter-spacing: var(--fh-tracking-normal);
}
.fh-user-btn > .fa-chevron-down { font-size: var(--fh-text-2xs); color: var(--fh-muted); }

/* User profile dropdown positioning & viewport constraints */
#user-profile-dropdown {
  position: relative;
}

#user-profile-dropdown .dropdown-menu {
  min-width: 14rem;
  max-width: calc(100vw - 1.25rem);
  margin-right: 0.5rem; /* Safe gutter from screen edge */
  right: 0 !important;
  left: auto !important;
  z-index: 1100 !important; /* Clears navbar (1050) and progress bar (1090) */
}

#user-profile-dropdown .dropdown-item {
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  transition: background-color var(--fh-transition-fast, 0.15s ease), color var(--fh-transition-fast, 0.15s ease);
}

#user-profile-dropdown .dropdown-item:hover,
#user-profile-dropdown .dropdown-item:focus {
  background: var(--fh-soft);
  color: var(--fh-text);
}

#user-profile-dropdown .dropdown-item:active {
  background: var(--fh-primary-soft, #eff6ff);
  color: var(--fh-primary, #2563eb);
}

#user-profile-dropdown .dropdown-item.text-danger:hover,
#user-profile-dropdown .dropdown-item.text-danger:focus {
  background: rgba(220, 38, 38, 0.08);
  color: var(--fh-danger);
}

#user-profile-dropdown .dropdown-item.text-danger:active {
  background: rgba(220, 38, 38, 0.12);
  color: var(--fh-danger);
}


