/* ==========================================================================
   Announcement bar, header, live search, mobile drawer, favorites sheet
   ========================================================================== */

/* Announcement ------------------------------------------------------------ */
.tv-announcement { background: var(--tv-announce-bg); color: var(--tv-announce-text); font-size: 13px; font-weight: 600; }
.tv-announcement-dismissed .tv-announcement { display: none; }
.tv-announcement-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding-block: 7px;
  padding-inline: 48px;
  text-align: center;
}
.tv-announcement-text { margin: 0; line-height: 1.4; }
.tv-announcement-text a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.tv-announcement-close {
  position: absolute;
  top: 50%;
  right: max(8px, calc(var(--tv-gutter) - 8px));
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  opacity: .7;
  transform: translateY(-50%);
  transition: opacity .2s, background-color .2s;
}
.tv-announcement-close:hover { opacity: 1; background: color-mix(in srgb, currentColor 14%, transparent); }

/* Header ------------------------------------------------------------------ */
.tv-header {
  position: sticky;
  top: var(--tv-adminbar-h, 0px);
  z-index: 50;
  border-bottom: 1px solid color-mix(in srgb, var(--tv-header-text) 10%, transparent);
  background: var(--tv-header-bg);
  color: var(--tv-header-text);
  transition: transform .32s var(--tv-ease), box-shadow .32s var(--tv-ease);
}
.tv-header.is-scrolled { box-shadow: 0 12px 28px -22px rgba(15, 23, 42, .5); }
.tv-header-hidden .tv-header { transform: translateY(-110%); }
.tv-header-inner { display: flex; align-items: center; gap: clamp(10px, 2vw, 24px); min-height: 72px; }

.tv-brand { display: flex; flex-shrink: 0; align-items: center; }
.tv-brand .custom-logo { width: auto; max-height: 44px; }
.tv-brand-text {
  color: inherit;
  font-family: var(--tv-font-heading);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  text-decoration: none;
}
.tv-brand-text:hover { color: inherit; }
.tv-brand-dot { color: var(--tv-color-accent); }

.tv-primary-nav .tv-menu { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; }
.tv-menu > li { position: relative; }
.tv-menu a {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  opacity: .8;
  transition: opacity .2s, background-color .2s;
}
.tv-menu a:hover, .tv-menu .current-menu-item > a, .tv-menu .current-menu-ancestor > a {
  opacity: 1;
  background: color-mix(in srgb, currentColor 7%, transparent);
  color: inherit;
}
.tv-menu .sub-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 5;
  min-width: 220px;
  margin: 0;
  padding: 8px;
  list-style: none;
  border: 1px solid var(--tv-color-border);
  border-radius: 14px;
  background: var(--tv-color-surface);
  color: var(--tv-color-text-main);
  box-shadow: var(--tv-shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .2s var(--tv-ease), transform .2s var(--tv-ease), visibility .2s;
}
.tv-menu li:hover > .sub-menu, .tv-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.tv-menu .sub-menu a { display: flex; height: auto; padding: 9px 12px; opacity: 1; }

.tv-header-search { position: relative; flex: 1 1 300px; max-width: 440px; margin-left: auto; }
.tv-header-actions { display: flex; flex-shrink: 0; align-items: center; gap: 2px; }
.tv-menu-toggle, .tv-search-toggle { display: none; }

/* Live search ------------------------------------------------------------- */
.tv-search-form { position: relative; }
.tv-search-field { position: relative; display: flex; align-items: center; }
.tv-search-field > .tv-icon { position: absolute; left: 15px; color: var(--tv-color-text-muted); pointer-events: none; }
.tv-search-field input[type="search"] {
  height: 46px;
  padding-left: 44px;
  border-color: color-mix(in srgb, var(--tv-header-text) 12%, transparent);
  border-radius: var(--tv-radius-pill);
  background: color-mix(in srgb, var(--tv-header-text) 3%, var(--tv-header-bg));
  color: var(--tv-header-text);
}
.tv-search-form.is-loading .tv-search-field::after {
  content: "";
  position: absolute;
  right: 16px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--tv-color-border-hover);
  border-right-color: transparent;
  border-radius: 50%;
  animation: tv-spin .7s linear infinite;
}
.tv-search-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 60;
  max-height: min(70vh, 540px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--tv-color-border);
  border-radius: 18px;
  background: var(--tv-color-surface);
  color: var(--tv-color-text-main);
  box-shadow: var(--tv-shadow-lg);
}
.tv-search-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}
.tv-search-item:hover, .tv-search-item.is-active { background: var(--tv-color-muted-bg); color: inherit; }
.tv-search-thumb {
  width: 56px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 9px;
  background: linear-gradient(135deg, #18153e, #3730a3);
}
.tv-search-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tv-search-text { min-width: 0; }
.tv-search-title {
  display: block;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-search-title mark { padding: 0 1px; border-radius: 3px; background: color-mix(in srgb, var(--tv-color-accent) 30%, transparent); color: inherit; }
.tv-search-meta { display: block; color: var(--tv-color-text-muted); font-size: 12px; }
.tv-search-price { font-family: var(--tv-font-heading); font-size: 14px; font-weight: 800; white-space: nowrap; }
.tv-search-price del { margin-right: 4px; color: var(--tv-color-text-subtle); font-size: 12px; font-weight: 500; }
.tv-search-price ins { text-decoration: none; }
.tv-search-footer:empty { display: none; }
.tv-search-all {
  display: block;
  margin-top: 4px;
  padding: 12px;
  border-top: 1px solid var(--tv-color-divider);
  color: var(--tv-color-text-main);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.tv-search-all:hover { background: var(--tv-color-muted-bg); border-radius: 0 0 12px 12px; }
.tv-search-empty { padding: 14px 12px; color: var(--tv-color-text-muted); font-size: 14px; }

@media (max-width: 1080px) {
  .tv-primary-nav { display: none; }
  .tv-menu-toggle { display: inline-grid; margin-left: -8px; }
}
@media (max-width: 760px) {
  :root { --tv-header-h: 60px; }
  .tv-header-inner { flex-wrap: wrap; gap: 4px; min-height: 60px; }
  .tv-brand { margin-right: auto; }
  .tv-brand-text { font-size: 1.35rem; }
  .tv-search-toggle { display: inline-grid; }
  .tv-account-link { display: none; }
  .tv-header-search { display: none; order: 10; flex-basis: 100%; max-width: none; margin: 0 0 12px; }
  .tv-header.is-search-open .tv-header-search { display: block; }
}

/* Drawer & sheet ---------------------------------------------------------- */
.tv-drawer, .tv-sheet {
  position: fixed;
  top: 0;
  bottom: 0;
  width: min(88vw, 380px);
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--tv-color-surface);
  box-shadow: var(--tv-shadow-lg);
}
.tv-drawer { right: auto; left: 0; }
.tv-sheet { right: 0; left: auto; width: min(92vw, 420px); }
.tv-drawer[open] { animation: tv-in-left .32s var(--tv-ease); }
.tv-sheet[open] { animation: tv-in-right .32s var(--tv-ease); }
.tv-drawer.is-closing { animation: tv-out-left .2s ease forwards; }
.tv-sheet.is-closing { animation: tv-out-right .2s ease forwards; }
@keyframes tv-in-left { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes tv-out-left { to { transform: translateX(-100%); } }
@keyframes tv-in-right { from { transform: translateX(100%); } to { transform: none; } }
@keyframes tv-out-right { to { transform: translateX(100%); } }

.tv-drawer-inner, .tv-sheet-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--tv-color-surface);
}
.tv-drawer-header, .tv-sheet-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px 10px 20px;
  border-bottom: 1px solid var(--tv-color-border);
  background: var(--tv-color-surface);
}
.tv-drawer-header .tv-brand-text { color: var(--tv-color-text-main); font-size: 1.35rem; }
.tv-drawer-search { padding: 16px 20px 8px; }
.tv-drawer-search .tv-search-field input[type="search"] { border-color: var(--tv-color-border); background: var(--tv-color-muted-bg); color: var(--tv-color-text-main); }
.tv-drawer-search .tv-search-panel { position: static; margin-top: 8px; box-shadow: none; }

.tv-drawer-menu { margin: 0; padding: 8px 12px; list-style: none; }
.tv-drawer-menu li { position: relative; display: flex; flex-wrap: wrap; align-items: center; }
.tv-drawer-menu a {
  flex: 1;
  padding: 13px 10px;
  border-radius: 12px;
  color: var(--tv-color-text-main);
  font-family: var(--tv-font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
}
.tv-drawer-menu a:hover, .tv-drawer-menu .current-menu-item > a { background: var(--tv-color-muted-bg); }
.tv-drawer-menu .sub-menu { flex-basis: 100%; margin: 0 0 6px 12px; padding: 0 0 0 10px; list-style: none; border-left: 2px solid var(--tv-color-border); }
.tv-drawer-menu .sub-menu a { padding: 9px 10px; font-family: var(--tv-font-sans); font-size: .95rem; font-weight: 600; }
.tv-submenu-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--tv-color-text-muted);
  transition: transform .2s var(--tv-ease);
}
.tv-submenu-toggle[aria-expanded="true"] { transform: rotate(180deg); }

.tv-drawer-quick { display: grid; gap: 4px; margin: 4px 12px 0; padding: 12px 0 0; list-style: none; border-top: 1px solid var(--tv-color-border); }
.tv-drawer-quick a, .tv-drawer-quick button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--tv-color-text-body);
  font-size: .95rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}
.tv-drawer-quick a:hover, .tv-drawer-quick button:hover { background: var(--tv-color-muted-bg); color: var(--tv-color-text-main); }
.tv-drawer-count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: var(--tv-radius-pill);
  background: var(--tv-badge-popular-bg);
  color: var(--tv-badge-popular-text);
  font-size: 12px;
  font-weight: 800;
}
.tv-drawer-footer { margin-top: auto; padding: 20px; }
.tv-drawer-footer .tv-social a { color: var(--tv-color-text-body); }

/* Favorites sheet */
.tv-sheet-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.2rem; }
.tv-sheet-title .tv-icon { color: #e11d48; }
.tv-sheet-count {
  padding: 1px 9px;
  border-radius: var(--tv-radius-pill);
  background: var(--tv-color-divider);
  color: var(--tv-color-text-muted);
  font-family: var(--tv-font-sans);
  font-size: 12px;
}
.tv-sheet-body { flex: 1; padding: 12px 16px; }
.tv-sheet-body[aria-busy="true"] { opacity: .6; }
.tv-sheet-note {
  margin: 0;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--tv-color-border);
  background: var(--tv-color-muted-bg);
  color: var(--tv-color-text-muted);
  font-size: 13px;
}
.tv-sheet-note a { color: var(--tv-color-text-main); font-weight: 700; }
.tv-fav-rows { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tv-fav-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--tv-color-divider);
  border-radius: 14px;
}
.tv-fav-thumb { display: block; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 10px; background: linear-gradient(135deg, #18153e, #3730a3); }
.tv-fav-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tv-fav-info { display: grid; gap: 2px; min-width: 0; }
.tv-fav-title { overflow: hidden; color: var(--tv-color-text-main); font-size: 14px; font-weight: 700; line-height: 1.3; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.tv-fav-meta { color: var(--tv-color-text-muted); font-size: 12px; }
.tv-fav-price { font-family: var(--tv-font-heading); font-size: 14px; font-weight: 800; color: var(--tv-color-text-main); }
.tv-fav-price del { margin-right: 4px; color: var(--tv-color-text-subtle); font-size: 12px; font-weight: 500; }
.tv-fav-price ins { text-decoration: none; }
.tv-fav-remove {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--tv-color-text-subtle);
}
.tv-fav-remove:hover { background: var(--tv-badge-sale-bg); color: var(--tv-badge-sale-text); }
.tv-favorites-empty { display: grid; justify-items: center; gap: 14px; padding: 48px 12px; text-align: center; color: var(--tv-color-text-muted); }
.tv-favorites-empty .tv-icon { color: var(--tv-color-border-hover); }
.tv-favorites-empty p { max-width: 26ch; margin: 0; }
