/* Civics-specific Styles */

.civic-explanation {
  width: fit-content;
  margin: 0 auto;
  align-self: center;
  padding: 0 1rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.civic-explanation p {
  margin: 0;
}

/* Civics Container */
#civics-container {
  width: 100%;
  padding: clamp(0.5rem, 1vw, 1rem) clamp(0.5rem, 3vw, 2rem) clamp(2rem, 4vw, 3rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(0.75rem, 1vw, 1.25rem);
}

.civic-columns {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  align-content: flex-start;
  gap: clamp(0.5rem, 0.5vw, 1rem);
}

/* Hide scrollbar for Chrome/Safari/Webkit */
#civics-container::-webkit-scrollbar {
  display: none;
}

.tier-section {
  flex: 0 0 auto;
  width: 100%;
  max-width: 220px;
  transition: all 500ms ease;
}

@media (max-width: 479px) {
  .tier-section {
    max-width: 100%;
    min-width: 100%;
  }
}

.tier-banner {
  color: var(--text-inverse);
  padding: 0.15rem 0.3rem;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  border-radius: 3px;
  margin-bottom: 0.1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.civic-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: auto;
  gap: 0.25rem;
  width: 100%;
  max-width: 100%;
}

.civic-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  font-size: 0.7rem;
  line-height: 1.3;
  min-height: 0;
  height: 100%;
  gap: 0.10rem;
  overflow: visible;
  word-break: break-word;
  position: relative;
}

.civic-card .civic-name {
  font-weight: 600;
  font-size: clamp(0.75rem, 1.8vw, 0.9rem);
  margin: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  width: 100%;
  line-height: 1.15;
}

.civic-card .civic-lore {
  font-size: clamp(0.65rem, 1.6vw, 0.8rem);
  line-height: 1.3;
  overflow: visible;
}

.civic-value {
  color: var(--primary);
  font-weight: 600;
}

.civic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  border-color: var(--primary);
}

.civic-header {
  margin-bottom: 1rem;
}

.civic-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.civic-lore {
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 0.95rem;
  margin: 0;
}

/* Tier-specific colors */
.tier-section[data-tier="1"] .tier-banner { background: var(--tier-1); }
.tier-section[data-tier="2"] .tier-banner { background: var(--tier-2); }
.tier-section[data-tier="3"] .tier-banner { background: var(--tier-3); }
.tier-section[data-tier="4"] .tier-banner { background: var(--tier-4); }
.tier-section[data-tier="5"] .tier-banner { background: var(--tier-5); }
.tier-section[data-tier="6"] .tier-banner { background: var(--tier-6); }
.tier-section[data-tier="7"] .tier-banner { background: var(--tier-7); }
.tier-section[data-tier="8"] .tier-banner { background: var(--tier-8); }
.tier-section[data-tier="9"] .tier-banner { background: var(--tier-9); }
.tier-section[data-tier="10"] .tier-banner { background: var(--tier-10); }
.tier-section[data-tier="11"] .tier-banner { background: var(--tier-11); }
.tier-section[data-tier="12"] .tier-banner { background: var(--tier-12); }
.tier-section[data-tier="13"] .tier-banner { background: var(--tier-13); }
.tier-section[data-tier="14"] .tier-banner { background: var(--tier-14); }
.tier-section[data-tier="15"] .tier-banner { background: var(--tier-15); }

/* Tier background colors for civic cards */
.tier-section[data-tier="1"] .civic-card { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.3); }
.tier-section[data-tier="2"] .civic-card { background: rgba(6, 182, 212, 0.1); border-color: rgba(6, 182, 212, 0.3); }
.tier-section[data-tier="3"] .civic-card { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.3); }
.tier-section[data-tier="4"] .civic-card { background: rgba(132, 204, 22, 0.1); border-color: rgba(132, 204, 22, 0.3); }
.tier-section[data-tier="5"] .civic-card { background: rgba(234, 179, 8, 0.1); border-color: rgba(234, 179, 8, 0.3); }
.tier-section[data-tier="6"] .civic-card { background: rgba(249, 115, 22, 0.1); border-color: rgba(249, 115, 22, 0.3); }
.tier-section[data-tier="7"] .civic-card { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); }
.tier-section[data-tier="8"] .civic-card { background: rgba(236, 72, 153, 0.1); border-color: rgba(236, 72, 153, 0.3); }
.tier-section[data-tier="9"] .civic-card { background: rgba(168, 85, 247, 0.1); border-color: rgba(168, 85, 247, 0.3); }
.tier-section[data-tier="10"] .civic-card { background: rgba(99, 102, 241, 0.1); border-color: rgba(99, 102, 241, 0.3); }
.tier-section[data-tier="11"] .civic-card { background: rgba(20, 184, 166, 0.1); border-color: rgba(20, 184, 166, 0.3); }
.tier-section[data-tier="12"] .civic-card { background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.3); }
.tier-section[data-tier="13"] .civic-card { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); }
.tier-section[data-tier="14"] .civic-card { background: rgba(249, 115, 22, 0.1); border-color: rgba(249, 115, 22, 0.3); }
.tier-section[data-tier="15"] .civic-card { background: rgba(220, 38, 38, 0.1); border-color: rgba(220, 38, 38, 0.3); }

/* Research status highlighting - uses CSS custom properties for customizable colors */
.civic-card.civic-researched {
  --color-researched: var(--color-researched-custom, #326fd1);
  background: linear-gradient(135deg, rgba(var(--color-researched-rgb, 50, 111, 209), 0.5) 0%, rgba(var(--color-researched-rgb, 50, 111, 209), 0.4) 100%) !important;
  border-color: rgba(var(--color-researched-rgb, 50, 111, 209), 0.95) !important;
  box-shadow: 0 0 8px rgba(var(--color-researched-rgb, 50, 111, 209), 0.8), inset 0 0 8px rgba(255, 255, 255, 0.1);
}

.civic-card.civic-researched .civic-lore {
  color: #ffffff !important;
}

.civic-card.civic-queued {
  --color-queued: var(--color-queued-custom, #7db7ff);
  background: linear-gradient(135deg, rgba(var(--color-queued-rgb, 125, 183, 255), 0.5) 0%, rgba(var(--color-queued-rgb, 125, 183, 255), 0.4) 100%) !important;
  border-color: rgba(var(--color-queued-rgb, 125, 183, 255), 0.95) !important;
  box-shadow: 0 0 8px rgba(var(--color-queued-rgb, 125, 183, 255), 0.8), inset 0 0 8px rgba(255, 255, 255, 0.1);
}

.civic-card.civic-queued .civic-lore {
  color: #ffffff !important;
}

.civic-card.civic-researching {
  --color-researching: var(--color-researching-custom, #f59e0b);
  background: linear-gradient(135deg, rgba(var(--color-researching-rgb, 245, 158, 11), 0.4) 0%, rgba(var(--color-researching-rgb, 245, 158, 11), 0.3) 100%) !important;
  border-color: rgba(var(--color-researching-rgb, 245, 158, 11), 0.95) !important;
  box-shadow: 0 0 12px rgba(var(--color-researching-rgb, 245, 158, 11), 0.9), inset 0 0 8px rgba(255, 255, 255, 0.1);
  animation: pulse-civic-researching 2s ease-in-out infinite;
}

.civic-card.civic-researching .civic-lore {
  color: #ffffff !important;
}

@keyframes pulse-civic-researching {
  0%, 100% {
    box-shadow: 0 0 12px rgba(var(--color-researching-rgb, 245, 158, 11), 0.9), inset 0 0 8px rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 20px rgba(var(--color-researching-rgb, 245, 158, 11), 1), inset 0 0 8px rgba(255, 255, 255, 0.15);
  }
}

/* Queue order badge for civics */
.civic-queue-order {
   position: absolute;
   right: 0.35em;
   bottom: 0.35em;
   min-width: 1.4em;
   height: 1.4em;
   padding: 0 0.25em;
   border-radius: 999px;
   background: rgba(15, 23, 42, 0.6);
   color: var(--gray-50);
   font-size: clamp(10px, 0.65em, 13px);
   font-weight: 700;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   pointer-events: none;
 }

/* Settings container for civics page */
.civics-page .settings-container {
   position: relative;
   flex-shrink: 0;
 }

.civics-page .settings-menu {
   position: absolute;
   top: 100%;
   right: 0;
   margin-top: 0.5rem;
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: 8px;
   box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
   min-width: 180px;
   max-width: 220px;
   z-index: 1000;
   backdrop-filter: blur(8px);
   display: none;
   opacity: 1;
   transform: none;
   pointer-events: auto;
   overflow-y: auto;
   overscroll-behavior: contain;
 }

.civics-page .settings-menu[style*="display: block"] {
   display: block !important;
 }
