/* FreeToolbox 구글 로그인 + 즐겨찾기 스타일 (작업 1, 2026-05-02)
   룰: 그림자·띠·이모지 X. 1px 테두리만. 직각 박스. 메인 톤 일관. */

/* ─── 헤더 로그인 버튼 ─── */
.ftbauth-slot {
  display: inline-flex;
  align-items: center;
  position: relative;
  margin-left: 0.6rem;
}
.ftbauth-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  background: #fff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 0;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
.ftbauth-login-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.ftbauth-login-btn svg {
  flex: 0 0 auto;
}

/* ─── 사용자 아바타 (로그인 후) ─── */
.ftbauth-user-btn {
  display: inline-flex;
  align-items: center;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}
.ftbauth-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ff9700;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}
.ftbauth-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ftbauth-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* ─── 사용자 드롭다운 메뉴 ─── */
.ftbauth-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.ftbauth-menu[hidden] { display: none; }
.ftbauth-menu-info {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}
.ftbauth-menu-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  word-break: keep-all;
}
.ftbauth-menu-email {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.15rem;
  word-break: break-all;
}
.ftbauth-menu-item {
  display: block;
  text-align: left;
  padding: 0.72rem 1rem;
  background: transparent;
  border: none;
  color: #334155;
  font-size: 0.92rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}
.ftbauth-menu-item:hover {
  background: #f8fafc;
}
.ftbauth-menu-logout {
  border-top: 1px solid #e2e8f0;
  color: #dc2626;
}

/* ─── 도구 카드 ★ 즐겨찾기 버튼 ─── */
.tool-card,
[data-tool-slug] {
  position: relative;
}
/* 별 자리 안전하게 확보 — 영어 긴 라벨 두 줄 박혀도 별 영역 침범 X */
.tool-card { padding-right: 52px !important; }
.tool-card span { min-width: 0; overflow-wrap: anywhere; word-break: break-word; line-height: 1.35; }
@media (max-width: 600px) {
  .tool-card { padding-right: 44px !important; }
  .ftbfav-star { width: 22px; height: 22px; right: 8px; }
}
.ftbfav-star {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}
.ftbfav-star:hover {
  background: rgba(241, 245, 249, 0.85);
}
.ftbfav-star.is-favorited:hover {
  background: rgba(254, 215, 170, 0.5);
}

/* ─── 메인 "내 즐겨찾기" 섹션 (테두리·배경 X — 다른 카테고리 섹션과 톤 일관) ─── */
.ftbfav-section {
  margin: 1.5rem 0 2rem;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
}
.ftbfav-section[hidden] { display: none; }
.ftbfav-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 0.85rem 0;
}
.ftbfav-section-title svg {
  flex: 0 0 auto;
}
.ftbfav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

/* ─── 비로그인 ★ 알림 모달 ─── */
.ftbauth-prompt-host {
  position: fixed; inset: 0; z-index: 10001;
  display: flex; align-items: center; justify-content: center;
}
.ftbauth-prompt-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.55); cursor: pointer;
}
.ftbauth-prompt-card {
  position: relative; background: #fff; border: 1px solid #cbd5e1;
  padding: 1.75rem 1.75rem 1.5rem; min-width: 300px; max-width: 380px;
  display: flex; flex-direction: column; align-items: center; gap: 0.85rem;
  text-align: center;
}
.ftbauth-prompt-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border: 1px solid #e2e8f0; border-radius: 50%;
}
.ftbauth-prompt-title { font-size: 1.05rem; font-weight: 600; color: #1e293b; }
.ftbauth-prompt-desc { font-size: 0.92rem; color: #64748b; line-height: 1.55; word-break: keep-all; }
.ftbauth-prompt-actions { display: flex; gap: 0.5rem; width: 100%; margin-top: 0.4rem; }
.ftbauth-prompt-cancel,
.ftbauth-prompt-login {
  flex: 1; padding: 0.6rem; cursor: pointer; font-family: inherit;
  font-size: 0.95rem; border-radius: 0; border: 1px solid;
}
.ftbauth-prompt-cancel { background: transparent; color: #64748b; border-color: #cbd5e1; }
.ftbauth-prompt-login { background: #ff9700; color: #fff; border-color: #ff9700; font-weight: 600; }
.ftbauth-prompt-cancel:hover { background: #f8fafc; }
.ftbauth-prompt-login:hover { background: #ea6e0d; border-color: #ea6e0d; }

/* ─── 구글 로그인 폴백 모달 (One Tap 안 뜰 때) ─── */
.ftbauth-google-host {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ftbauth-google-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
}
.ftbauth-google-card {
  position: relative;
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 1.5rem 1.5rem 1rem;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.ftbauth-google-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}
.ftbauth-google-cancel {
  background: transparent;
  border: 1px solid #cbd5e1;
  padding: 0.4rem 1rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  color: #64748b;
}
.ftbauth-google-cancel:hover {
  background: #f8fafc;
}

/* ─── 도구 페이지 안 ★ 즐겨찾기 버튼 (h1 옆) ─── */
.tool-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.tool-title-row h1 {
  flex: 1 1 auto;
  margin: 0;
}
.ftbfav-star-tool {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  color: #64748b;
  margin-top: 0.4rem;
}
.ftbfav-star-tool:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.ftbfav-star-tool.is-favorited {
  border-color: #ff9700;
  color: #ff9700;
  background: #fff7ed;
}
.ftbfav-star-tool .ftbfav-star-empty { display: inline; }
.ftbfav-star-tool .ftbfav-star-filled { display: none; }
.ftbfav-star-tool.is-favorited .ftbfav-star-empty { display: none; }
.ftbfav-star-tool.is-favorited .ftbfav-star-filled { display: inline; }
/* favorites 페이지에는 ★ 버튼 자체가 의미 없음 */
.ftbfav-star-tool[data-tool-slug="favorites"] { display: none; }

/* ─── 사이드바 도구 li 안 ★ ─── */
.ftbfav-sidebar-item {
  position: relative;
  padding-right: 26px;
}
.ftbfav-sidebar-item > .ftbfav-star {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
}
.ftbfav-sidebar-item > .ftbfav-star svg {
  width: 14px;
  height: 14px;
}

/* ─── 즐겨찾기 페이지·도구 페이지에서 .tools-grid + .tool-card 사용 ─── */
/* (메인 index.html에만 박힌 정의를 도구 layout 안에서도 동작하게) */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.tool-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0;
  text-decoration: none;
  color: var(--text, #111827);
  transition: all 0.2s;
}
.tool-card:hover {
  border-color: var(--accent, #ff9700);
}
.tool-card span {
  font-size: 0.88rem;
  font-weight: 500;
}
@media (max-width: 600px) {
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.5rem; }
  .tool-card { padding: 0.65rem 0.75rem; gap: 0.5rem; }
  .tool-card span { font-size: 0.82rem; }
}

/* ─── 즐겨찾기 페이지 안내 카드 ─── */
.ftbfav-page-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 0;
  color: #64748b;
}
.ftbfav-page-card[hidden],
#ftbfav-page-grid[hidden],
#ftbfav-page-loading[hidden] {
  display: none !important;
}
.ftbfav-page-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #1e293b;
}
.ftbfav-page-card p {
  margin: 0.3rem 0;
  font-size: 0.95rem;
  line-height: 1.55;
  word-break: keep-all;
}
.ftbfav-page-card a { color: #ff9700; text-decoration: underline; }
.ftbfav-page-btn {
  margin-top: 1rem;
  padding: 0.65rem 1.4rem;
  background: #ff9700;
  color: #fff;
  border: 1px solid #ff9700;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
}
.ftbfav-page-btn:hover { background: #ea6e0d; border-color: #ea6e0d; }

/* ─── PC 헤더 즐겨찾기 링크 (블로그·소개 톤 일관) ─── */
.header-link-fav {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #64748b;
  font-size: 1rem;
  text-decoration: none;
  font-weight: 500;
  margin-right: 0.8rem;
  margin-left: 0.6rem;
}
.header-link-fav:hover {
  color: #ff9700;
}
.header-link-fav svg {
  flex: 0 0 auto;
}

/* ─── 모바일 ─── */
@media (max-width: 768px) {
  /* 모바일은 헤더에서 G 로그인·즐겨찾기 숨김 → 모바일 탭바로 이동 */
  .header-actions .ftbauth-slot { display: none; }
  .header-link-fav { display: none; }

  /* 폴백: 헤더 G 모달이 떠도 안 깨지게 */
  .ftbauth-menu { right: 0; min-width: 200px; }
  .ftbfav-grid { grid-template-columns: repeat(2, 1fr); }

  /* 모바일 탭바 로그인 활성 상태 — JS가 .is-loggedin 박음 */
  .mobile-tabbar .tab-item.is-loggedin { color: #ff9700; }
  .mobile-tabbar .tab-item.is-loggedin svg { color: #ff9700; stroke: #ff9700; }
}
