/* ============================================================
   Três Fios v2 — Layout principal (header glass + footer + nav)
   ============================================================ */

/* --- Header --- */
.tf-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-header);
  background: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201,169,76,0.12);
  transition: box-shadow var(--t-base) ease;
}

#app-content {
  padding-top: var(--header-h);
}
.tf-header--scrolled { box-shadow: var(--shadow-md); }

.tf-header__bar { height: var(--header-h); display: flex; align-items: center; }

.tf-header__inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
}

.tf-header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: opacity var(--t-fast) ease;
}
.tf-header__logo:hover { opacity: 0.85; }
.tf-header__logo-img { height: 48px; width: auto; }
.tf-header__logo img { height: 50px; width: auto; }

.tf-header__nav { display: flex; align-items: center; gap: var(--sp-1); }

.tf-header__link {
  padding: 0.5rem 1rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--grafite);
  border-radius: var(--radius-sm);
  position: relative;
  transition: color var(--t-fast) ease, background var(--t-fast) ease;
}
.tf-header__link:hover { color: var(--vinho); background: rgba(107,29,42,0.05); }

.tf-header__dropdown { position: relative; }
.tf-header__dropdown summary { padding: 0.5rem 1rem; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; border-radius: var(--radius-sm); list-style: none; transition: color var(--t-fast) ease, background var(--t-fast) ease; }
.tf-header__dropdown summary::-webkit-details-marker { display: none; }
.tf-header__dropdown summary:hover { color: var(--vinho); background: rgba(107,29,42,0.05); }
.tf-header__dropdown[open] summary { color: var(--vinho); }

.tf-header__dropdown-menu {
  position: absolute;
  top: calc(100% + 8px); left: 0;
  min-width: 220px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--branco);
  border: 1px solid var(--cinza-claro);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-2);
  display: grid;
  gap: 2px;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.tf-header__dropdown[open] .tf-header__dropdown-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.tf-header__dropdown-link {
  display: block;
  padding: 0.625rem 0.875rem;
  font-size: var(--fs-sm);
  color: var(--grafite);
  border-radius: var(--radius-sm);
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}
.tf-header__dropdown-link:hover { background: var(--cinza-fundo); color: var(--vinho); }

.tf-header__actions { display: flex; align-items: center; gap: var(--sp-2); }

/* User dropdown (mesmo estilo do dropdown de categorias) */
.tf-header__user-dropdown summary { padding: 0.5rem 1rem; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; border-radius: var(--radius-sm); list-style: none; transition: color var(--t-fast) ease, background var(--t-fast) ease; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-header__user-dropdown summary::-webkit-details-marker { display: none; }
.tf-header__user-dropdown summary:hover { color: var(--vinho); background: rgba(107,29,42,0.05); }
.tf-header__user-dropdown[open] summary { color: var(--vinho); }
.tf-header__user-menu { right: 0; left: auto; }
.tf-header__user-divider { border: none; border-top: 1px solid var(--cinza-claro); margin: var(--sp-1) 0; }

/* Admin dropdown */
.tf-header__admin-dropdown summary { padding: 0.5rem 1rem; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; border-radius: var(--radius-sm); list-style: none; transition: color var(--t-fast) ease, background var(--t-fast) ease; color: var(--dourado); }
.tf-header__admin-dropdown summary::-webkit-details-marker { display: none; }
.tf-header__admin-dropdown summary:hover { color: var(--vinho); background: rgba(201,169,76,0.1); }
.tf-header__admin-dropdown[open] summary { color: var(--vinho); }
.tf-header__admin-menu { right: 0; left: auto; }

/* Mobile user menu items (hidden on desktop) */
#tf-user-mobile { display: none; }
#tf-user-mobile a { display: block; }
.tf-header__nav-divider { border: none; border-top: 1px solid var(--cinza-claro); margin: var(--sp-3) 0; }
.tf-header__nav-label { display: block; padding: 0.5rem 1rem; font-size: var(--fs-xs); font-weight: 600; color: var(--cinza); text-transform: uppercase; letter-spacing: 1px; }

.tf-header__search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--cinza-fundo);
  border-radius: var(--radius-full);
  padding: 0.375rem 2.5rem 0.375rem 1.25rem;
  width: 220px;
  transition: box-shadow var(--t-fast) ease, width var(--t-base) ease;
}
.tf-header__search:focus-within {
  box-shadow: 0 0 0 2px rgba(107,29,42,0.12);
  width: 260px;
}
.tf-header__search-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: var(--fs-sm);
  outline: none;
}
.tf-header__search-btn {
  position: absolute;
  right: 0.375rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: var(--cinza);
  transition: color var(--t-fast) ease, background var(--t-fast) ease;
  border: none;
  cursor: pointer;
  background: none;
}
.tf-header__search-btn:hover { color: var(--vinho); background: rgba(107,29,42,0.08); }

.tf-header__icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  color: var(--grafite);
  transition: color var(--t-fast) ease, background var(--t-fast) ease;
}
.tf-header__icon-btn:hover { color: var(--vinho); background: rgba(107,29,42,0.06); }
.tf-header__icon-btn svg { width: 20px; height: 20px; }

.tf-header__cart-count {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--vinho);
  color: var(--branco);
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.tf-header__menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  color: var(--grafite);
}
.tf-header__menu-toggle:hover { background: rgba(107,29,42,0.06); }
.tf-header__menu-toggle svg { width: 22px; height: 22px; }

/* --- Footer --- */
.tf-footer {
  background: #0A0A0A;
  color: rgba(255,255,255,0.55);
  padding: var(--sp-12) 0 0;
  margin-top: var(--sp-12);
}

.tf-footer__grid {
  display: grid;
  grid-template-columns: 2.5fr 1fr 1.2fr 1.5fr;
  gap: var(--sp-8);
  padding-bottom: var(--sp-10);
}

.tf-footer__logo {
  filter: brightness(0) invert(1);
  opacity: 0.5;
  margin-bottom: var(--sp-4);
  height: 45px;
  width: auto;
}

.tf-footer__about {
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  color: rgba(255,255,255,0.4);
  margin-bottom: var(--sp-5);
  max-width: 350px;
}

.tf-footer__social { display: flex; gap: var(--sp-2); }

.tf-footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.4);
  transition: all var(--t-base) var(--ease);
}
.tf-footer__social-link:hover {
  border-color: var(--dourado);
  color: var(--dourado);
  background: rgba(201,169,76,0.08);
}
.tf-footer__social-link svg { width: 18px; height: 18px; }

.tf-footer__title {
  color: var(--branco);
  font-family: var(--font-titulo);
  font-size: 1.05rem;
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid rgba(201,169,76,0.15);
}

.tf-footer__list { display: grid; gap: var(--sp-2); }

.tf-footer__list a {
  color: rgba(255,255,255,0.45);
  font-size: var(--fs-sm);
  transition: all var(--t-fast) ease;
  padding: 0.25rem 0;
  display: inline-block;
}
.tf-footer__list a:hover { color: var(--dourado); transform: translateX(4px); }

.tf-footer__contact {
  font-size: var(--fs-sm);
  color: rgba(255,255,255,0.4);
  line-height: 1.7;
  margin-bottom: var(--sp-2);
}

.tf-footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: var(--sp-5) 0;
  text-align: center;
  font-size: var(--fs-xs);
  color: rgba(255,255,255,0.25);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .tf-header__bar { height: var(--header-h-mobile); }
  .tf-header__logo-img { height: 36px; }
  .tf-header__nav {
    position: fixed;
    top: var(--header-h-mobile);
    left: 0; right: 0;
    background: var(--branco);
    flex-direction: column;
    padding: var(--sp-4);
    gap: var(--sp-1);
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
    border-bottom: 1px solid var(--cinza-claro);
  }
  .tf-header__nav--open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .tf-header__menu-toggle { display: flex; }
  .tf-header__search { display: none; }
  #tf-user-mobile { display: block; width: 100% }
  .tf-header__nav .tf-header__link,
  .tf-header__nav .tf-header__dropdown,
  .tf-header__nav .tf-header__dropdown summary { width: 100%; text-align: left; }
  .tf-header__dropdown-menu { position: static; opacity: 1; transform: none; pointer-events: auto; box-shadow: none; padding-left: var(--sp-4); border: none; max-height: none; }
  .tf-header__nav .tf-header__link,
  .tf-header__nav .tf-header__dropdown,
  .tf-header__nav .tf-header__dropdown summary { width: 100%; text-align: left; padding: 0.5rem 1rem; }
  .tf-footer__grid { grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
  #tf-admin-dropdown { display: none; }
}
@media (max-width: 480px) {
  .tf-footer__grid { grid-template-columns: 1fr; }
  .tf-header__logo img { height: 25px; }

}