/* frontend/css/components.css */
/* EUNHA PROJECT - 컴포넌트 스타일 */

/* ===== Input Panel ===== */
#inputPanel {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  background: var(--panel2);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

#inputHeader {
  user-select: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 900;
  color: var(--green);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 10px;
  position: relative;
}

#inputHeader > div:nth-child(1) {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  white-space: nowrap;
}

#inputHeader > div:nth-child(3) {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  margin-left: 0;
}

#pasteAnalyzeHeaderButton {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  justify-content: center;
  white-space: nowrap;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 14px;
  box-shadow: 0 6px 14px rgba(31,58,138,0.14);
}

#inputPanel.collapsed #pasteAnalyzeHeaderButton {
  display: flex;
}

#inputHeader small {
  font-weight: 800;
  color: var(--muted);
}

#inputBody {
  padding: 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

#textArea {
  width: 100%;
  height: 170px;
  resize: vertical;
  border-radius: 14px;
  border: 2px solid var(--mint);
  padding: 12px 12px;
  font-size: 15px;
  line-height: 1.65;
  background: #fff;
}

#parseButton {
  flex: 1 1 280px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

#pasteAnalyzeButton {
  flex: 0 0 auto;
  background: var(--primaryBlue);
  color: #fff;
  font-weight: 950;
  border: 1px solid rgba(15,23,42,0.10);
}

#analysisLoading {
  display: none;
  margin-top: 10px;
  font-weight: 900;
  color: var(--green);
}

#toggleHint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

/* ===== Text Display Panel ===== */
#textDisplay {
  background: #fff;
  border: 1px solid rgba(34,139,34,0.25);
  border-radius: 14px;
  padding: 14px;
  line-height: 1.8;
}

#textDisplay p {
  margin: 8px 0;
  font-size: 16px;
  color: #2f2f2f;
  opacity: 0.72;
}

#textDisplay .current {
  font-size: 22px;
  font-weight: 950;
  color: var(--green);
  opacity: 1;
}

#position {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 6px;
  font-weight: 900;
}

#navigation {
  display: flex;
  gap: 10px;
  margin: 10px 0 14px;
}

#navigation button {
  width: 100%;
  background: var(--mint);
  color: var(--green);
  font-weight: 900;
}

/* ===== Speaker Select ===== */
#speakerSelect optgroup {
  font-weight: 950;
}

#speakerSelect option[disabled] {
  color: var(--green) !important;
  -webkit-text-fill-color: var(--green) !important;
  font-weight: 950 !important;
  opacity: 1 !important;
}

/* ===== Controls Row ===== */
.controlsRow {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-top: 12px;
  flex-wrap: wrap;
}

.toggleWrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(34,139,34,0.25);
  background: #fbfffb;
  flex: 1 1 240px;
  min-width: 240px;
}

.toggleWrap .label {
  font-weight: 950;
  color: var(--green);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.toggleWrap .desc {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

/* ===== Toggle Switch ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(34,139,34,0.20);
  transition: .2s;
  border-radius: 999px;
  border: 1px solid rgba(34,139,34,0.25);
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 2.5px;
  background: white;
  transition: .2s;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

input:checked + .slider {
  background: var(--green);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

.modeSelect {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(34,139,34,0.35);
  background: #fbfffb;
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  min-width: 120px;
}

.modeSelect:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(34,139,34,0.15);
}

/* ===== Slider Box ===== */
.sliderBox {
  flex: 1 1 320px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(34,139,34,0.25);
  background: #fbfffb;
  min-width: 280px;
}

.sliderBox label {
  display: block;
  text-align: left;
  font-weight: 950;
  color: var(--green);
  margin-bottom: 8px;
  font-size: 13px;
}

#speedSlider {
  width: 100%;
}

#speedValue {
  text-align: center;
  margin-top: 6px;
  font-weight: 950;
  color: var(--green);
}

#playButton {
  width: 100%;
  background: var(--green);
  color: #fff;
  font-weight: 950;
  margin-top: 12px;
}

#creditText {
  display: none;
  text-align: center;
  margin-top: 10px;
  font-size: 12px;
  color: #555;
  font-style: italic;
  font-weight: 700;
}

/* ===== Vocab Panel ===== */
#rightPanel {
  position: relative;
}

#rightHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

#rightHeader h3 {
  margin: 0;
  color: var(--green);
  font-size: 15px;
  font-weight: 950;
}

#vocabMeta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

#vocabScroll {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(34,139,34,0.18);
  flex: 1 1 auto;
  max-height: 640px;
}

#vocabTable {
  width: 100%;
  border-collapse: collapse;
}

#vocabTable th,
#vocabTable td {
  border: 1px solid rgba(144,238,144,0.9);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

#vocabTable th {
  background: #e6f7e6;
  font-weight: 950;
  color: #1f6f1f;
  position: sticky;
  top: 0;
  z-index: 1;
}

#vocabStatus {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  min-height: 18px;
  padding-right: 170px;
  padding-bottom: 10px;
  word-break: keep-all;
}

/* ===== Status Dots ===== */
.statusDots {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
}

.statusDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  transition: all 0.3s ease;
}

.statusDot.ok {
  background: #4ade80;
  box-shadow: 0 0 4px rgba(74,222,128,0.5);
}

.statusDot.warn {
  background: #fbbf24;
  box-shadow: 0 0 4px rgba(251,191,36,0.5);
}

.statusDot.error {
  background: #f87171;
  box-shadow: 0 0 4px rgba(248,113,113,0.5);
}

/* ===== Vocab Progress Bar ===== */
#vocabStatusWrap {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(34,139,34,0.04);
  border-radius: 10px;
  transition: opacity 0.5s ease;
}

#vocabStatusWrap.fade-out {
  opacity: 0;
  pointer-events: none;
}

#vocabStatusWrap.hidden {
  display: none;
}

#vocabProgressBar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

#vocabProgressFill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--mint));
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 3px;
}

#vocabProgressFill.analyzing {
  animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#vocabStatusText {
  font-size: 13px;
  color: var(--green);
  font-weight: 800;
  text-align: center;
}

/* ===== Skeleton Loading ===== */
.skeleton-row td {
  padding: 12px 10px !important;
}
.skeleton-block {
  height: 14px;
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Hover Cross-highlighting ===== */
#textDisplay p.current span.vh {
  padding: 0 1px;
  border-radius: 4px;
  cursor: default;
}

#textDisplay p.current span.vh.hl {
  background: rgba(120, 220, 120, 0.28);
}

#vocabBody tr.hl {
  background: rgba(120, 220, 120, 0.28) !important;
}

.vocab-table tr.hl,
.vocab-table tr:hover.hl {
  background: rgba(120, 220, 120, 0.28) !important;
}

#vocabBody tr.hl td {
  background: transparent !important;
}

/* ===== Ruby Words (Special Reading) ===== */
#vocabBody tr.ruby-word {
  background: linear-gradient(90deg, rgba(147, 112, 219, 0.10) 0%, rgba(255,255,255,0) 100%);
}

#vocabBody tr.ruby-word td:first-child::before {
  content: "💠";
  margin-right: 4px;
  font-size: 10px;
}

#vocabBody tr.ruby-word .ruby-source-tag {
  display: inline-block;
  font-size: 10px;
  color: #7c3aed;
  background: rgba(147, 112, 219, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 700;
}

#vocabBody tr.ruby-word.hl {
  background: linear-gradient(90deg, rgba(147, 112, 219, 0.18) 0%, rgba(120, 220, 120, 0.20) 100%) !important;
}

/* ===== Tier-2 Sense Sub-lines ===== */
.sense-sub {
  font-size: 0.82em;
  color: var(--muted, #6b7280);
  margin-top: 1px;
  line-height: 1.3;
}

/* ===== Merged Words (Super Heavy Mode) ===== */
.merged-word,
.merged-read {
  color: var(--muted);
  font-size: 0.9em;
}

.merged-word::before,
.merged-read::before {
  content: "+";
  margin: 0 2px;
  color: var(--green);
  font-weight: 600;
}

/* ===== Ruby Text Highlight ===== */
#textDisplay p.current ruby.ruby-hl {
  background: linear-gradient(90deg, rgba(147, 112, 219, 0.25) 0%, rgba(120, 220, 120, 0.30) 100%);
  border-radius: 3px;
  padding: 1px 2px;
}

#textDisplay p.current ruby.ruby-hl rt {
  color: #7c3aed;
  font-weight: 600;
}

/* ===== Ruby (Furigana) Styles ===== */
#textDisplay ruby {
  ruby-position: over;
}

#textDisplay ruby rt {
  font-size: 0.55em;
  color: var(--muted);
  font-weight: 500;
}

#textDisplay p.current ruby rt {
  color: var(--green);
  font-weight: 600;
}

/* ===== Beta Warning Modal ===== */
#betaWarnOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
  pointer-events: auto;
  touch-action: none;
}

#betaWarnOverlay.show {
  display: flex;
}

#betaWarnCard {
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  overflow: hidden;
}

#betaWarnImg {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== Auth System (에이전트 A) - 상업 서비스 수준 UI ===== */

#auth-buttons {
  display: flex;
  align-items: center;
  min-height: 40px;
}

/* 로딩 스피너 */
.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.auth-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(34,139,34,0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* 로그인 버튼 (비로그인 상태) */
.auth-login-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--green) 0%, #2d8a2d 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(34,139,34,0.25);
}

.auth-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(34,139,34,0.35);
}

.auth-login-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(34,139,34,0.25);
}

/* 프로필 영역 (로그인 상태) */
.auth-profile {
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  background: rgba(34,139,34,0.06);
  border: 1px solid rgba(34,139,34,0.15);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-trigger:hover {
  background: rgba(34,139,34,0.1);
  border-color: rgba(34,139,34,0.25);
}

.profile-trigger.active {
  background: rgba(34,139,34,0.12);
  border-color: var(--green);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.profile-caret {
  color: var(--muted);
  transition: transform 0.2s ease;
}

.profile-trigger.active .profile-caret {
  transform: rotate(180deg);
}

/* 프로필 드롭다운 */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 280px;
  max-width: calc(100vw - 32px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top left;
  transition: all 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

.profile-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(34,139,34,0.06) 0%, rgba(34,139,34,0.02) 100%);
}

.dropdown-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.dropdown-info {
  min-width: 0;
  flex: 1;
}

.dropdown-name {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-email {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.dropdown-item:hover {
  background: #f9fafb;
}

.dropdown-item svg {
  color: var(--muted);
  flex-shrink: 0;
}

.dropdown-tier {
  cursor: default;
}

.dropdown-tier:hover {
  background: none;
}

.upgrade-badge {
  margin-left: auto;
  padding: 3px 8px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
}

.dropdown-logout {
  color: #dc2626;
}

.dropdown-logout:hover {
  background: #fef2f2;
}

.dropdown-logout svg {
  color: #dc2626;
}

.dropdown-logout.loading {
  opacity: 0.7;
  pointer-events: none;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(220,38,38,0.2);
  border-top-color: #dc2626;
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
}

/* ===== 로그인 모달 ===== */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.login-modal.show {
  opacity: 1;
  visibility: visible;
}

.login-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.login-modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.login-modal.show .login-modal-content {
  transform: scale(1) translateY(0);
}

.login-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 1;
}

.login-modal-close:hover {
  background: #e5e7eb;
  color: #374151;
}

.login-modal-header {
  padding: 40px 32px 24px;
  text-align: center;
}

.login-modal-header h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  color: #1f2937;
}

.login-modal-header p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.login-modal-buttons {
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.social-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.social-login-btn:hover {
  transform: translateY(-1px);
}

.social-login-btn:active {
  transform: translateY(0);
}

.social-login-btn.google {
  background: white;
  color: #374151;
  box-shadow: 0 0 0 1px #e5e7eb, 0 2px 8px rgba(0,0,0,0.08);
}

.social-login-btn.google:hover {
  box-shadow: 0 0 0 1px #d1d5db, 0 4px 16px rgba(0,0,0,0.12);
}

.social-login-btn.kakao {
  background: #FEE500;
  color: #000000;
  box-shadow: 0 2px 8px rgba(254,229,0,0.4);
}

.social-login-btn.kakao:hover {
  box-shadow: 0 4px 16px rgba(254,229,0,0.5);
}

.social-icon {
  flex-shrink: 0;
}

.login-modal-footer {
  padding: 24px 32px 32px;
  text-align: center;
}

.login-modal-footer p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.login-modal-footer a {
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
}

.login-modal-footer a:hover {
  text-decoration: underline;
}

/* ===== Korzina Header Link ===== */
.header-spacer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.header-korzina-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  transition: opacity 0.12s;
  white-space: nowrap;
}

.header-korzina-link:hover {
  opacity: 0.88;
}

.korzina-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #fff;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  line-height: 1;
}

.korzina-nav-badge:empty {
  display: none;
}

/* ===== Usage Dashboard Bar ===== */
.usage-dashboard {
  background: #fff;
  border-bottom: 1px solid rgba(34,139,34,0.1);
  padding: 8px 16px;
}
.usage-dashboard-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.usage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 160px;
}
.usage-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.usage-icon { font-size: 14px; }
.usage-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.usage-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.usage-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease, background 0.3s;
  width: 0%;
  background: var(--green);
}
.usage-bar-fill.warning { background: #f59e0b; }
.usage-bar-fill.danger { background: #ef4444; }
.usage-count {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
  min-width: 40px;
}
.usage-upgrade-link {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  padding: 4px 12px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.usage-upgrade-link:hover { opacity: 0.85; }

@media (max-width: 640px) {
  .usage-dashboard-inner { gap: 12px; }
  .usage-item { min-width: 120px; }
}

/* Tier Badge */
.header-tier-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  margin-right: 10px;
  transition: opacity 0.2s;
}
.header-tier-badge:hover { opacity: 0.8; }
.header-tier-badge.tier-free {
  background: #f0f0f0;
  color: #666;
  border: 1px solid #ddd;
}
.header-tier-badge.tier-premium {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #fff;
  border: none;
}
.header-tier-badge.tier-anonymous {
  background: #f8f8f8;
  color: #aaa;
  border: 1px solid #eee;
}

/* ===== History Button & Drawer ===== */
.header-history-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: rgba(34,139,34,0.08);
  color: var(--green);
  border: 1px solid rgba(34,139,34,0.2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 8px;
}
.header-history-btn:hover {
  background: rgba(34,139,34,0.14);
  border-color: rgba(34,139,34,0.35);
}
.history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
}
.history-backdrop.show {
  opacity: 1;
  visibility: visible;
}
.history-drawer {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.12);
  z-index: 9999;
  transition: right 0.25s ease;
  display: flex;
  flex-direction: column;
}
.history-drawer.show {
  right: 0;
}
.history-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.history-drawer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--green);
}
.history-drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 8px;
}
.history-drawer-close:hover {
  background: #f3f4f6;
}
.history-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.history-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 16px;
}
.history-card {
  padding: 12px 14px;
  border: 1px solid rgba(34,139,34,0.15);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.history-card:hover {
  background: rgba(34,139,34,0.04);
  border-color: rgba(34,139,34,0.3);
}
.history-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}
.history-card-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.history-card-rename {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.4;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.history-card:hover .history-card-rename { opacity: 0.8; }
.history-card-rename:hover { opacity: 1 !important; }
.history-card-preview {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.history-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 11px;
  color: #9ca3af;
}
.history-card-delete {
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
}
.history-card-delete:hover {
  color: #ef4444;
  background: #fef2f2;
}
.history-card-expired {
  opacity: 0.5;
  border-style: dashed;
}

/* ===== Signup Nudge ===== */
.signup-nudge {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-bottom: 1px solid rgba(34,139,34,0.15);
  padding: 10px 16px;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.signup-nudge-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #166534;
  font-weight: 600;
}
.signup-nudge-btn {
  padding: 6px 16px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.signup-nudge-btn:hover { opacity: 0.9; }
.signup-nudge-close {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  margin-left: auto;
}

/* ===== 소형 모바일 헤더 — 2줄 레이아웃 (iPhone 12 mini 등) ===== */
@media (max-width: 480px) {
  .auth-login-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
  .header-korzina-link {
    padding: 7px 14px;
    font-size: 12px;
  }
  .header-history-btn span { display: none; }
  .header-history-btn {
    padding: 7px 10px;
    margin-right: 4px;
  }
  .header-tier-badge {
    margin-right: 6px;
  }
}
