/* ================================================================
   IMPÉRIO SUPREMO — Game Layout CSS
   ================================================================ */

/* ── Layout principal ───────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .game-title {
  font-size: 1rem; font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
  display: block;
}
.sidebar-logo .game-sub {
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 1px; text-transform: uppercase;
}

/* Diamantes no sidebar */
.sidebar-diamonds {
  padding: 10px 16px;
  background: rgba(139,92,246,0.1);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--purple);
  cursor: pointer;
}
.sidebar-diamonds:hover { background: rgba(139,92,246,0.2); }

/* Nav items */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section-label {
  padding: 10px 16px 4px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  margin: 1px 6px;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 500;
  position: relative;
  user-select: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: rgba(59,130,246,0.15);
  color: var(--blue);
  border-left: 2px solid var(--blue);
  margin-left: 4px;
  padding-left: 14px;
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
  min-width: 18px; text-align: center;
}
.nav-item .nav-badge.gold { background: var(--gold); color: #000; }

/* Player card no sidebar */
.sidebar-player {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.sidebar-player:hover { background: var(--bg-hover); }
.player-mini { display: flex; align-items: center; gap: 10px; }
.player-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.player-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.player-level { font-size: 11px; color: var(--text-muted); }
.player-title { font-size: 10px; font-weight: 600; }

/* ── Main content ────────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Top bar ─────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
.topbar-resources {
  display: flex; align-items: center; gap: 4px;
  flex: 1; overflow-x: auto;
  padding-right: 12px;
}
.res-pill {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  white-space: nowrap;
  transition: border-color var(--transition);
  flex-shrink: 0;
}
.res-pill:hover { border-color: var(--border-light); }
.res-pill .label { font-size: 10px; color: var(--text-muted); display: none; }
.res-pill .val   { font-size: 13px; font-weight: 700; font-family: var(--font-mono); }
.res-pill .prod  { font-size: 10px; color: var(--green); display: none; }
.res-pill.gold-pill .val  { color: var(--gold); }
.res-pill.food-pill .val  { color: var(--green); }
.res-pill.wood-pill .val  { color: var(--orange); }
.res-pill.stone-pill .val { color: #94a3b8; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
  position: relative;
}
.topbar-btn:hover { border-color: var(--blue); color: var(--text-primary); }
.topbar-btn .notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--red); border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

/* ── Content area ────────────────────────────────────────────── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 1.5rem; font-weight: 800; }
.page-header p  { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── Dashboard stats ─────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.stat-icon { font-size: 28px; margin-bottom: 8px; display: block; }
.stat-value { font-size: 1.4rem; font-weight: 800; font-family: var(--font-mono); }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ── Building cards ──────────────────────────────────────────── */
.building-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: all var(--transition);
  position: relative; overflow: hidden;
}
.building-card.upgrading { border-color: var(--gold); }
.building-card.upgrading::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold-dk), var(--gold));
  animation: buildingPulse 1.5s ease-in-out infinite;
}
@keyframes buildingPulse { 0%,100%{opacity:0.6} 50%{opacity:1} }
.building-icon   { font-size: 28px; text-align: center; }
.building-name   { font-weight: 700; font-size: 14px; text-align: center; }
.building-level  { text-align: center; }
.building-lvl-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px; font-weight: 700; color: var(--text-secondary);
  font-family: var(--font-mono);
}
.building-prod   { font-size: 11px; color: var(--text-muted); text-align: center; }
.building-cost   { font-size: 11px; color: var(--text-muted); }
.building-cost span { font-weight: 600; }
.building-timer  { text-align: center; }
.progress-label  { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

/* ── Troop cards ─────────────────────────────────────────────── */
.troop-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.troop-header { display: flex; align-items: center; gap: 12px; }
.troop-icon   { font-size: 32px; }
.troop-info   { flex: 1; }
.troop-name   { font-weight: 700; font-size: 15px; }
.troop-qty    { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 800; color: var(--gold); }
.troop-stats  { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.troop-stat   { background: var(--bg-secondary); border-radius: 6px; padding: 6px 8px; }
.troop-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.troop-stat-value { font-size: 13px; font-weight: 700; margin-top: 2px; }

/* ── Territory map ───────────────────────────────────────────── */
.map-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.map-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all var(--transition);
  position: relative;
}
.map-cell:hover { transform: scale(1.1); z-index: 10; }
.map-cell.neutral  { background: rgba(100,116,139,0.15); border-color: rgba(100,116,139,0.2); }
.map-cell.owned    { border-color: var(--gold); }
.map-cell.enemy    { border-color: var(--red); }
.map-cell.allied   { border-color: var(--green); }
.map-cell.my-own   { background: rgba(59,130,246,0.25); border-color: var(--blue); }

/* Influence bar within region */
.influence-bar-wrap { display: flex; height: 6px; border-radius: 99px; overflow: hidden; width: 100%; gap: 1px; }
.influence-seg { height: 100%; transition: width 0.5s ease; }

/* ── Market ──────────────────────────────────────────────────── */
.listing-row { cursor: pointer; }
.listing-row:hover td { background: var(--bg-hover); }
.price-tag { font-family: var(--font-mono); font-weight: 700; color: var(--gold); }

/* ── Tech tree ───────────────────────────────────────────────── */
.tech-grid { display: grid; gap: 12px; }
.tech-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; gap: 14px; align-items: flex-start;
  transition: all var(--transition);
  cursor: pointer;
}
.tech-card:hover { border-color: var(--border-light); }
.tech-card.researched { border-color: var(--green); background: rgba(16,185,129,0.05); }
.tech-card.researching { border-color: var(--gold); }
.tech-card.locked { opacity: 0.5; cursor: not-allowed; }
.tech-icon  { font-size: 28px; flex-shrink: 0; }
.tech-info  { flex: 1; }
.tech-name  { font-weight: 700; font-size: 14px; }
.tech-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tech-bonus { font-size: 12px; color: var(--cyan); margin-top: 4px; font-weight: 600; }
.tech-status-badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 700; }
.tech-status-badge.done { background: rgba(16,185,129,0.2); color: var(--green); }
.tech-status-badge.doing { background: rgba(245,158,11,0.2); color: var(--gold); }

/* ── Hero panel ──────────────────────────────────────────────── */
.hero-portrait {
  width: 100px; height: 100px; border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f, #2d1b69);
  border: 3px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  margin: 0 auto 12px;
  box-shadow: var(--shadow-gold);
}
.hero-attr {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}
.hero-attr-icon  { font-size: 18px; }
.hero-attr-name  { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.hero-attr-value { font-size: 1.2rem; font-weight: 800; color: var(--gold); font-family: var(--font-mono); }

/* ── Achievement cards ───────────────────────────────────────── */
.achievement-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; gap: 12px;
  transition: all var(--transition);
}
.achievement-card.unlocked   { border-color: rgba(245,158,11,0.4); }
.achievement-card.not-unlocked { opacity: 0.6; }
.ach-icon  { font-size: 28px; flex-shrink: 0; width: 40px; text-align: center; }
.ach-name  { font-weight: 700; font-size: 14px; }
.ach-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ach-progress { margin-top: 8px; }

/* ── Daily login calendar ────────────────────────────────────── */
.login-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.cal-day {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 6px;
  text-align: center;
  transition: all var(--transition);
  cursor: default;
}
.cal-day.today { border-color: var(--gold); background: rgba(245,158,11,0.1); }
.cal-day.claimed { border-color: var(--green); background: rgba(16,185,129,0.1); }
.cal-day.special { border-color: var(--purple); }
.cal-day .day-n  { font-size: 10px; color: var(--text-muted); }
.cal-day .day-reward { font-size: 18px; margin: 4px 0; }
.cal-day .day-gold   { font-size: 10px; color: var(--gold); font-weight: 700; }

/* ── News feed ───────────────────────────────────────────────── */
.news-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; gap: 14px;
  transition: all var(--transition);
}
.news-item:hover { border-color: var(--border-light); }
.news-item.pinned { border-left: 3px solid var(--gold); }
.news-cat  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.news-headline { font-weight: 700; font-size: 14px; }
.news-body     { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.news-time     { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Ranking table ───────────────────────────────────────────── */
.rank-1 td { background: rgba(245,158,11,0.08) !important; }
.rank-2 td { background: rgba(100,116,139,0.08) !important; }
.rank-3 td { background: rgba(205,127,50,0.08) !important; }
.rank-medal { font-size: 18px; }
.rank-num { font-family: var(--font-mono); font-weight: 800; font-size: 15px; }

/* ── Season standings ────────────────────────────────────────── */
.season-banner {
  background: linear-gradient(135deg, #1e1b4b, #312e81, #4c1d95);
  border: 1px solid rgba(139,92,246,0.4);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  position: relative; overflow: hidden;
}
.season-banner::before {
  content: ''; position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(245,158,11,0.05), transparent 70%);
  animation: seasonGlow 4s ease-in-out infinite;
}
@keyframes seasonGlow { 0%,100%{opacity:0.5} 50%{opacity:1} }

/* ── Diplomacy relations ─────────────────────────────────────── */
.relation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.relation-card.active   { border-color: var(--green); }
.relation-card.pending  { border-color: var(--gold); }
.relation-card.war      { border-color: var(--red); }
.rel-icon  { font-size: 28px; width: 40px; text-align: center; }
.rel-type  { font-weight: 700; }
.rel-parties { font-size: 12px; color: var(--text-muted); }
.rel-expires { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Alliance panel ──────────────────────────────────────────── */
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: none; }
.member-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-hover); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.member-name   { font-weight: 600; font-size: 13px; }
.member-role   { font-size: 10px; color: var(--text-muted); }
.member-power  { margin-left: auto; font-family: var(--font-mono); font-weight: 700; color: var(--gold); font-size: 13px; }

/* Chat */
.chat-box { height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg-secondary); border-radius: var(--radius); border: 1px solid var(--border); }
.chat-msg { }
.chat-author { font-size: 11px; font-weight: 700; color: var(--blue); }
.chat-text   { font-size: 13px; color: var(--text-secondary); }
.chat-time   { font-size: 10px; color: var(--text-muted); }
.chat-input-wrap { display: flex; gap: 8px; margin-top: 8px; }

/* ── Influence map region list ───────────────────────────────── */
.region-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: all var(--transition);
}
.region-card:hover { border-color: var(--border-light); cursor: pointer; }
.region-name  { font-weight: 700; font-size: 14px; }
.region-type  { font-size: 11px; color: var(--text-muted); }
.region-ctrl  { font-size: 12px; color: var(--green); font-weight: 600; margin-top: 6px; }
.region-ctrl.neutral { color: var(--text-muted); }
.region-ctrl.contested { color: var(--gold); }

/* ── Revolt risk indicator ───────────────────────────────────── */
.revolt-risk { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.revolt-indicator {
  width: 10px; height: 10px; border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}
.revolt-indicator.low    { background: var(--green); }
.revolt-indicator.medium { background: var(--gold); }
.revolt-indicator.high   { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* ── Mobile sidebar toggle ───────────────────────────────────── */
#sidebar-toggle {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
  #main { margin-left: 0; }
  #sidebar-toggle { display: block; }
  .topbar-resources .res-pill .label,
  .topbar-resources .res-pill .prod { display: none; }
  #content { padding: 16px 12px; }
  .map-grid { grid-template-columns: repeat(5, 1fr); }
  .login-calendar { grid-template-columns: repeat(4, 1fr); }
}
