/* components.css — Buttons, Tabellen, Panels, Info-Boxes */

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-xs);
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  font-weight: bold;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(to bottom, #d4922e, #a06820);
  color: var(--text-light);
  border-color: var(--border-dark);
  text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(to bottom, #e8a840, #b87830);
}

.btn-secondary {
  background: linear-gradient(to bottom, var(--bg-panel), var(--bg-row-odd));
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(to bottom, var(--bg-content), var(--bg-panel));
}

.btn-danger {
  background: linear-gradient(to bottom, #b03020, #7a1a10);
  color: var(--text-light);
  border-color: var(--border-dark);
}
.btn-danger:hover:not(:disabled) {
  background: linear-gradient(to bottom, #c84030, #8a2020);
}

.btn-success {
  background: linear-gradient(to bottom, #5a8a28, #3a6018);
  color: var(--text-light);
  border-color: var(--border-dark);
}
.btn-success:hover:not(:disabled) {
  background: linear-gradient(to bottom, #6aa030, #4a7020);
}

.btn-sm {
  padding: 2px 8px;
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: 6px 18px;
  font-size: var(--font-size-lg);
}

/* ── Tables ──────────────────────────────────────────────────── */
.game-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  font-size: 13px;
}

.game-table th {
  background: var(--bg-header-row);
  color: #1a0f06;
  font-weight: bold;
  padding: 5px var(--gap-sm);
  border: 1px solid var(--border);
  text-align: left;
  font-family: var(--font-ui);
  font-size: 14px;
}

.game-table td {
  padding: 4px var(--gap-sm);
  border: 1px solid var(--border-light);
  vertical-align: middle;
}

.game-table tr:nth-child(even) td {
  background: var(--bg-row-even);
}
.game-table tr:nth-child(odd) td {
  background: var(--bg-row-odd);
}
.game-table tr:hover td {
  background: #e8d8a0;
}

.game-table .col-icon {
  width: 28px;
  text-align: center;
}
.game-table .col-num {
  text-align: right;
}

/* ── Info Box ────────────────────────────────────────────────── */
.info-box {
  padding: var(--gap-sm) var(--gap-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--gap-sm);
  font-size: 13px;
}

.info-box-info {
  background: #ddeeff;
  border-color: var(--blue);
  color: #1a3a6a;
}

.info-box-warning {
  background: #fff3cc;
  border-color: var(--amber);
  color: #7a4a00;
}

.info-box-error {
  background: #ffdddd;
  border-color: var(--red);
  color: var(--red);
}

.info-box-success {
  background: #ddffdd;
  border-color: var(--green);
  color: var(--green);
}

/* ── Cost Display ────────────────────────────────────────────── */
.cost-display {
  display: flex;
  gap: var(--gap-md);
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: bold;
}

.cost-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.cost-item.can-afford {
  color: var(--green);
}

.cost-item.cannot-afford {
  color: var(--red);
  font-weight: bold;
}

/* ── Badge ───────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: bold;
  line-height: 1.4;
}

.badge-amber  { background: var(--amber);      color: white; }
.badge-green  { background: var(--green);       color: white; }
.badge-red    { background: var(--red);         color: white; }
.badge-muted  { background: var(--text-muted);  color: white; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: var(--gap-md) 0;
}

/* ── Grid helpers ────────────────────────────────────────────── */
.flex-row {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.text-muted  { color: var(--text-muted); }
.text-bold   { font-weight: bold; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-sm     { font-size: var(--font-size-sm); }
.text-lg     { font-size: var(--font-size-lg); }
.text-green  { color: #2d6e1e; }
.text-red    { color: #8b1a1a; }
.text-amber  { color: var(--amber); }

/* ── Button size aliases ─────────────────────────────────────── */
/* btn-sm already defined above; btn-small is an alias used in JS */
.btn-small {
  padding: 2px 8px;
  font-size: var(--font-size-sm);
}

.btn-xs {
  padding: 1px 6px;
  font-size: 0.8em;
  border-radius: 3px;
}

/* ── Max-level Badge ─────────────────────────────────────────── */
.badge-max {
  display: inline-block;
  background: #d4a853;
  color: #1a0e00;
  font-size: 14px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: bold;
  text-transform: uppercase;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Tooltip-System (Sprint B) ──────────────────────────── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,10,2,0.95);
  color: #f0d890;
  font-size: 12px;
  font-family: Tahoma, Arial, sans-serif;
  white-space: pre-line;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #5a3e1b;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease 0.3s;
  z-index: 9999;
  min-width: 160px;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
[data-tooltip]:hover::after {
  opacity: 1;
}
/* Tooltip nach unten wenn oben kein Platz */
[data-tooltip-bottom]::after {
  bottom: auto;
  top: calc(100% + 6px);
}
/* Tooltip nach rechts ausrichten */
[data-tooltip-right]::after {
  left: 0;
  transform: none;
}

/* ── Card-System (Sprint D — global) ─────────────────────── */
/* Defined also in overview.css/tribe-market.css — components.css ensures global availability */
.card {
  background: rgba(0,0,0,0.55);
  border: 1px solid #5a3e1b;
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}
.card-header {
  background: rgba(90,62,27,0.5);
  padding: 8px 12px;
  font-weight: bold;
  color: #1a0f06;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.card-body {
  padding: 10px 12px;
}

/* ── Tab-Wrap Standard-Padding ───────────────────────────── */
.tab-wrap {
  padding: 12px;
}

/* ── Tab Background Videos (Sprint C) ──────────────────── */
.tab-bg-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.25;
  pointer-events: none;
}

/* Tab-Content muss über dem Video liegen */
.tab-panel > div {
  position: relative;
  z-index: 1;
}

/* ── Spieler-Profil-Overlay (Sprint E1) ─────────────── */
.pprofile-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.65);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
.pprofile-backdrop.pprofile-visible {
  display: flex;
}
.pprofile-modal {
  background: rgba(48,30,10,0.98);
  border: 2px solid #7a5428;
  border-radius: 8px;
  padding: 0;
  min-width: 300px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
  overflow: hidden;
}
.pprofile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: rgba(90,62,27,0.55);
  border-bottom: 1px solid #7a5428;
  position: relative;
}
.pprofile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid #7a5428;
  object-fit: cover;
  flex-shrink: 0;
}
.pprofile-info { flex: 1; min-width: 0; }
.pprofile-name {
  font-size: 18px;
  font-weight: bold;
  color: #f8eeaa;
  margin-bottom: 4px;
}
.pprofile-tribe {
  font-size: 13px;
  color: #c8862a;
  font-weight: normal;
}
.pprofile-points {
  font-size: 14px;
  color: #e8d8a8;
}
.pprofile-coords {
  font-size: 13px;
  color: #c8a060;
  cursor: pointer;
  margin-top: 2px;
  display: inline-block;
  border-bottom: 1px dashed #7a5428;
}
.pprofile-coords:hover { color: #f0d890; }
.pprofile-close {
  position: absolute;
  top: 10px; right: 10px;
  background: none;
  border: none;
  color: #b08040;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.pprofile-close:hover { color: #f0d890; }
.pprofile-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.pprofile-actions .btn {
  flex: 1;
  min-width: 80px;
  font-size: 13px;
  padding: 7px 10px;
  text-align: center;
}

/* ── Klickbare Spielernamen (Sprint E1) ─────────────── */
.player-name-link {
  cursor: pointer;
  color: #1a0f06;
  border-bottom: 1px dashed rgba(90,62,27,0.5);
  transition: color 0.15s;
}
.player-name-link:hover { color: #5a2a08; }

/* ── Tab-Notification-Badges (Sprint E3) ─────────────── */
.tab-btn { position: relative; }

.tab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #8b1a1a;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  pointer-events: none;
  border: 1px solid #c03020;
  animation: badgePop 0.2s ease-out;
}
@keyframes badgePop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Tab mit ungelesenen Nachrichten — farbliche Hervorhebung */
.tab-btn.tab-has-unread {
  color: #fff !important;
  background: rgba(180, 40, 40, 0.25) !important;
  border-bottom: 2px solid #c03020 !important;
  animation: tabUnreadPulse 2.5s ease-in-out infinite;
}
@keyframes tabUnreadPulse {
  0%, 100% { background: rgba(180, 40, 40, 0.25); }
  50%       { background: rgba(180, 40, 40, 0.45); }
}

/* ── Gebäude/Truppen Detail-Links (Sprint E4) ─────────────── */
.building-detail-link {
  cursor: pointer;
  border-bottom: 1px dashed rgba(90,62,27,0.6);
  transition: color 0.15s;
}
.building-detail-link:hover { color: #5a2a08; }

.troop-detail-link {
  cursor: pointer;
  border-bottom: 1px dashed rgba(90,62,27,0.6);
  transition: color 0.15s;
}
.troop-detail-link:hover { color: #5a2a08; }

/* ── Markt: Händler-Reisezeit ────────────────────────────────── */
.market-travel-time {
  font-size: 12px;
  color: var(--text-muted, #6b4c2a);
  margin-left: 6px;
  white-space: nowrap;
}

/* ── Premium Shop (V1-Port) ───────────────────────────── */
.premium-token-btn {
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.premium-token-btn:hover {
  background: #3a2e00;
  border-color: var(--gold-light);
  box-shadow: 0 0 8px rgba(232,184,74,0.3);
}
.premium-token-btn.premium-active-glow {
  background: #3a2a00;
  border-color: var(--gold-light);
  box-shadow: 0 0 10px rgba(232,184,74,0.4);
  animation: tokenGlow 2.4s ease-in-out infinite;
}
@keyframes tokenGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(232,184,74,0.35); }
  50%       { box-shadow: 0 0 14px rgba(232,184,74,0.6); }
}
.premium-panel { max-width: 780px; }
/* Legacy header — keep for backwards compat */
.premium-header { display:none; }
/* New V2 header */
.prem-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(200,146,42,0.08);
  border: 1px solid rgba(200,146,42,0.25);
  border-radius: 10px;
  margin-bottom: 20px;
}
.prem-balance { display: flex; align-items: center; gap: 10px; }
.prem-star { font-size: 26px; }
.prem-token-count { font-size: 30px; font-weight: bold; color: var(--gold-light); }
.prem-token-label { font-size: 13px; color: var(--text-muted); }
/* Subtab navigation */
.prem-subtab-nav {
  display: flex;
  gap: 6px;
  background: rgba(0,0,0,0.25);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.prem-subtab-btn {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background 0.18s, color 0.18s;
}
.prem-subtab-btn:hover { background: rgba(200,146,42,0.12); color: var(--text-primary); }
.prem-subtab-btn.active {
  background: rgba(200,146,42,0.22);
  color: var(--gold-light);
  box-shadow: 0 0 8px rgba(200,146,42,0.18);
}
/* Section titles */
.prem-section { margin-bottom: 24px; }
.prem-section-title { font-size: 15px; color: var(--gold); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
/* Legacy feature badges — keep */
.premium-balance { display: flex; align-items: center; gap: 8px; }
.premium-star { font-size: 24px; }
.premium-token-count { font-size: 28px; font-weight: bold; color: var(--gold-light); }
.premium-token-label { font-size: 13px; color: var(--text-muted); }
.premium-active-features { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.feature-badge { font-size: 12px; padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.feature-build { background: rgba(40,120,60,0.18); border: 1px solid #3a7a48; color: #6dc882; }
.feature-res   { background: rgba(40,80,180,0.18); border: 1px solid #3a60b0; color: #80a8e8; }
.feature-inactive { background: rgba(80,60,40,0.18); border: 1px solid var(--border); color: var(--text-muted); opacity: 0.7; }
.premium-section { margin-bottom: 24px; }
.premium-section-title { font-size: 15px; color: var(--gold); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.premium-shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 540px) { .premium-shop-grid { grid-template-columns: 1fr; } }
.premium-shop-card {
  background: linear-gradient(160deg, #261c0c 0%, #1a1208 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.shop-card-title { font-size: 14px; font-weight: bold; color: var(--text); margin-bottom: 5px; }
.shop-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.premium-tier-row { display: flex; flex-direction: column; gap: 6px; }
.premium-tier-btn {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--gold);
  background: rgba(200,146,42,0.1);
  color: var(--gold-light);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  transition: background 0.2s, box-shadow 0.2s;
}
.premium-tier-btn:hover:not(.disabled) { background: rgba(200,146,42,0.22); box-shadow: 0 0 8px rgba(200,146,42,0.25); }
.premium-tier-btn.disabled, .premium-tier-btn:disabled {
  border-color: var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}
.premium-tier-btn small { display: block; font-size: 11px; font-weight: normal; margin-top: 2px; color: var(--text-muted); }
.login-claim-banner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 10px 14px; background: rgba(40,120,60,0.15); border: 1px solid #3a7a48;
  border-radius: 6px; margin-bottom: 12px; font-size: 14px; color: var(--text);
}
.login-claimed-banner {
  padding: 10px 14px; background: rgba(60,50,30,0.25); border: 1px solid var(--border);
  border-radius: 6px; margin-bottom: 12px; font-size: 13px; color: var(--text-muted); text-align: center;
}
.login-calendar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
@media (max-width: 480px) { .login-calendar { grid-template-columns: repeat(5, 1fr); } }
.cal-day { border-radius: 6px; padding: 6px 4px; text-align: center; border: 1px solid var(--border); font-size: 11px; line-height: 1.35; }
.cal-day-num { display: block; font-weight: bold; font-size: 12px; }
.cal-day-reward { display: block; font-size: 10px; margin-top: 2px; }
.cal-day.done { background: rgba(40,120,60,0.15); border-color: #3a7a48; color: #6dc882; }
.cal-day.today {
  background: rgba(200,146,42,0.18); border-color: var(--gold-light); color: var(--gold-light);
  font-weight: bold; box-shadow: 0 0 6px rgba(200,146,42,0.3);
  animation: calToday 1.8s ease-in-out infinite;
}
@keyframes calToday {
  0%, 100% { box-shadow: 0 0 5px rgba(200,146,42,0.3); }
  50%       { box-shadow: 0 0 12px rgba(200,146,42,0.55); }
}
.cal-day.future { background: rgba(60,40,20,0.12); color: var(--text-muted); opacity: 0.6; }
.login-reward-panel { max-width: 360px; text-align: center; }
.premium-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: linear-gradient(160deg, #2e220a 0%, #1c1408 100%);
  border: 1px solid var(--gold); border-radius: 6px; padding: 10px 22px;
  color: var(--gold-light); font-size: 14px; font-weight: 600; z-index: 9999;
  opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none; white-space: nowrap; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.premium-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Village Selector (Multi-Dorf Phase 2) ─────────────── */
.village-sel-btn {
  background: rgba(30,20,10,0.7);
  border: 1px solid #8B6914;
  color: #d4a853;
  padding: 2px 8px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 12px;
}
.village-sel-btn:hover { background: rgba(60,40,20,0.85); }
.village-sel-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #1a0f06;
  border: 1px solid #8B6914;
  border-radius: 4px;
  z-index: 9999;
  padding: 4px 0;
}
.village-sel-dropdown.hidden { display: none; }
.village-sel-item {
  padding: 6px 12px;
  cursor: pointer;
  color: #c8a96e;
  font-size: 13px;
  white-space: nowrap;
}
.village-sel-item:hover { background: rgba(212,168,83,0.15); }
.village-sel-item.active { color: #f0c040; font-weight: bold; }

/* ── Toast Notifications ──────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  pointer-events: all;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  border-left: 4px solid rgba(255,255,255,0.3);
}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-hiding {
  opacity: 0;
  transform: translateX(20px);
}

.toast-success { background: #1e6b3c; }
.toast-error   { background: #7d1a1a; }
.toast-warn    { background: #7d4e00; }
.toast-info    { background: #1a3a5c; }

.toast-icon {
  font-size: 15px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.toast-msg {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.toast-close:hover {
  color: #fff;
}

/* ── Ranking Sub-Tabs ──────────────────────────────────────── */
.ranking-subtabs { display:flex; gap:0; border-bottom:2px solid var(--border); margin-bottom:12px; }
.ranking-subtab { padding:8px 16px; background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:14px; border-bottom:2px solid transparent; margin-bottom:-2px; font-family:var(--font-ui); }
.ranking-subtab:hover { color:var(--text); }
.ranking-subtab-active { color:var(--text); border-bottom-color:var(--accent); font-weight:bold; }

/* ── Player Profile Self-Tabs ──────────────────────────────── */
.pprofile-stab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: #9a7040;
  font-size: 13px;
  font-family: var(--font-ui, inherit);
}
.pprofile-stab:hover {
  color: #c89050;
}
.pprofile-stab-active {
  border-bottom-color: #e8b84a;
  color: #f0c84e;
  font-weight: bold;
}
