/* ========================================
   COMPONENTS (Storage, Exchange, Upgrade)
   ======================================== */

/* Storage Component */
.resource-input-group {
  margin-bottom: 15px;
  padding: 12px;
  background: rgba(76, 111, 166, 0.1);
  border-radius: 10px;
  border: 1px solid rgba(76, 111, 166, 0.3);
}

.resource-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.resource-row > span:first-child {
  flex: 1;
}

.input-controls {
  display: flex;
  gap: 8px;
  flex: 0.7;
}

.resource-row input {
  flex: 1;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  min-width: 0;
}

.resource-row input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.storage-hint {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  margin-top: 15px;
}

/* Exchange Component */
.exchange-section {
  padding: 15px;
  background: rgba(76, 111, 166, 0.1);
  border-radius: 10px;
  margin-bottom: 15px;
  font-size: 16px;
}

.exchange-input {
  margin-bottom: 15px;
}

.exchange-input input {
  width: 100%;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(76, 111, 166, 0.3);
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
}

.exchange-input input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.exchange-result {
  padding: 15px;
  background: rgba(212, 175, 55, 0.1);
  border: 2px solid #d4af37;
  border-radius: 10px;
  text-align: center;
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: bold;
}

.exchange-rate {
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  text-align: center;
}

.exchange-rate p {
  margin: 5px 0;
  font-size: 14px;
}

.exchange-rate .minimum {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  margin-top: 10px;
}

/* Upgrade Modal Component */
.upgrade-building-info {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.upgrade-building-name {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  padding: 15px;
  background: rgba(76, 111, 166, 0.15);
  border-radius: 10px;
  text-align: center;
  border-left: 4px solid #d4af37;
}

.upgrade-building-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  text-align: left;
  background: linear-gradient(135deg, rgba(57, 79, 129, 0.24) 0%, rgba(29, 38, 69, 0.72) 100%);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-left-width: 1px;
}

.upgrade-hero-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-size: 22px;
  flex-shrink: 0;
}

.upgrade-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upgrade-hero-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 214, 102, 0.7);
}

.upgrade-hero-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.upgrade-level-hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
}

.upgrade-level-card {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.upgrade-level-card-next {
  border-color: rgba(86, 196, 116, 0.2);
  background: rgba(86, 196, 116, 0.08);
}

.upgrade-level-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.62);
}

.upgrade-level-value {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.upgrade-level-arrow {
  align-self: center;
  color: #d4af37;
  font-size: 22px;
  font-weight: 800;
}

.upgrade-section-title {
  margin-bottom: 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 700;
}

.upgrade-delta-card {
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(31, 41, 74, 0.76) 0%, rgba(20, 26, 49, 0.92) 100%);
  border: 1px solid rgba(97, 125, 195, 0.2);
}

.upgrade-delta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.upgrade-delta-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.82);
}

.upgrade-delta-values {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
}

.upgrade-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.upgrade-stat-item {
  flex: 1;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid rgba(76, 111, 166, 0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #d4af37;
}

.arrow-separator {
  flex: 0.3;
  background: rgba(212, 175, 55, 0.1);
  border-color: rgba(212, 175, 55, 0.4);
  color: #d4af37;
  font-size: 20px;
  padding: 0;
}

.upgrade-production-info {
  padding: 15px;
  background: linear-gradient(135deg, rgba(76, 111, 166, 0.15) 0%, rgba(55, 74, 107, 0.15) 100%);
  border: 1px solid rgba(76, 111, 166, 0.3);
  border-radius: 10px;
}

.production-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.production-row > span:first-child {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.production-values {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: bold;
}

.production-values .current {
  padding: 6px 12px;
  background: rgba(97, 97, 97, 0.3);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  min-width: 50px;
  text-align: center;
}

.production-values .arrow {
  color: #d4af37;
  font-size: 16px;
}

.production-values .new {
  padding: 6px 12px;
  background: rgba(76, 175, 80, 0.3);
  color: #4caf50;
  border-radius: 6px;
  font-size: 14px;
  min-width: 50px;
  text-align: center;
  font-weight: bold;
  border: 1px solid rgba(76, 175, 80, 0.5);
}

.upgrade-cost-section {
  padding: 12px;
  background: rgba(212, 175, 55, 0.1);
  border: 2px solid rgba(212, 175, 55, 0.4);
  border-radius: 10px;
}

.upgrade-cost-shell {
  padding: 14px;
  border-width: 1px;
  background: linear-gradient(180deg, rgba(44, 34, 11, 0.52) 0%, rgba(28, 23, 12, 0.82) 100%);
}

.upgrade-cost-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.upgrade-cost-item {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}

.upgrade-cost-item.sufficient {
  border-color: rgba(86, 196, 116, 0.2);
  background: rgba(86, 196, 116, 0.08);
}

.upgrade-cost-item.insufficient {
  border-color: rgba(255, 120, 120, 0.24);
  background: rgba(255, 120, 120, 0.08);
}

.upgrade-cost-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.upgrade-cost-resource {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
}

.upgrade-cost-status {
  font-size: 12px;
  font-weight: 700;
}

.upgrade-cost-item.sufficient .upgrade-cost-status {
  color: #78db9d;
}

.upgrade-cost-item.insufficient .upgrade-cost-status {
  color: #ff8b8b;
}

.upgrade-cost-item-values {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
}

.upgrade-cost-section h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cost-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.cost-value {
  font-size: 28px;
  font-weight: bold;
  color: #d4af37;
}

.cost-icon {
  font-size: 24px;
}

.player-gold-info {
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.upgrade-action-ok {
  color: #85e0a3;
  font-weight: 700;
}

.upgrade-action-bad {
  color: #ff8b8b;
  font-weight: 700;
}

.upgrade-result-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.upgrade-result-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-size: 28px;
  flex-shrink: 0;
}

.upgrade-result-level {
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
  font-weight: 600;
}

.attack-result-card {
  background: linear-gradient(180deg, rgba(26, 30, 52, 0.98) 0%, rgba(16, 19, 35, 0.98) 100%);
}

.attack-result-win {
  border: 1px solid rgba(86, 196, 116, 0.24);
}

.attack-result-lose {
  border: 1px solid rgba(255, 120, 120, 0.2);
}

.attack-result-title {
  margin-bottom: 12px;
}

.attack-result-summary {
  margin-bottom: 12px;
}

.attack-result-section {
  margin-top: 10px;
}

.attack-loss-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.attack-loss-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.attack-loss-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
}

.attack-level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.attack-level-row:last-child {
  border-bottom: 0;
}

.attack-level-chip {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.18);
  color: #f0cd67;
  font-size: 11px;
  font-weight: 700;
}

.attack-level-count {
  color: #fff;
  font-weight: 800;
}

.attack-empty-row {
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
}

.attack-search-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 220px;
  text-align: center;
}

.attack-search-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: #d4af37;
  animation: attack-search-spin 0.9s linear infinite;
}

.attack-search-title {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.attack-search-subtitle {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  max-width: 240px;
}

.reward-loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(7, 10, 19, 0.72);
  backdrop-filter: blur(4px);
  z-index: 3000;
  padding: 20px;
}

.reward-loading-overlay.active {
  display: flex;
}

.reward-loading-card {
  width: min(320px, 100%);
  padding: 22px 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(30, 37, 64, 0.98) 0%, rgba(16, 20, 35, 0.98) 100%);
  border: 1px solid rgba(244, 185, 60, 0.24);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
  text-align: center;
}

.reward-loading-spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: #f4b93c;
  animation: attack-search-spin 0.9s linear infinite;
}

.reward-loading-title {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.reward-loading-text {
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
}

@keyframes attack-search-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.friends-page-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}

.friends-hero-card,
.friends-link-card,
.friends-list-card {
  background: linear-gradient(180deg, rgba(21, 27, 49, 0.98) 0%, rgba(14, 19, 36, 0.98) 100%);
  border: 1px solid rgba(93, 118, 184, 0.18);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.friends-hero-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(143, 171, 255, 0.74);
  margin-bottom: 8px;
  font-weight: 700;
}

.friends-hero-title,
.friends-link-title,
.friends-list-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}

.friends-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.friends-stat-card {
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.friends-stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.friends-stat-value {
  font-size: 20px;
  color: #ffd666;
  font-weight: 800;
}

.friends-link-box {
  padding: 12px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.82);
  word-break: break-all;
  margin-bottom: 12px;
}

.friends-link-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.friend-item-name {
  color: #fff;
  font-weight: 700;
  margin-bottom: 2px;
}

.friend-item-username,
.friend-item-date,
.friends-empty,
.friends-loading {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

/* ========================================
   ACTION BUTTONS GRID
   ======================================== */

.action-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-buttons-grid .btn {
  flex: none;
}

/* ========================================
   TREASURY MODAL STYLES
   ======================================== */

.treasury-info-main {
  padding: 16px;
  background: linear-gradient(180deg, rgba(70, 30, 83, 0.38) 0%, rgba(26, 20, 42, 0.86) 100%);
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid rgba(190, 96, 214, 0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 22px rgba(0,0,0,0.16);
}

.treasury-level-display h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #fff;
}

.capacity-info {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.treasury-progress-bar {
  width: 100%;
  height: 14px;
  background: rgba(0, 0, 0, 0.26);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid rgba(190, 96, 214, 0.18);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #b04bd8 0%, #e4589d 55%, #ffbf69 100%);
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 18px rgba(228, 88, 157, 0.28);
}

.treasury-upgrade-section {
  padding: 0;
}

.max-level-reached {
  text-align: center;
  padding: 30px 15px;
}

.max-level-reached .max-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ffd700 0%, #d4af37 100%);
  color: #000;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 15px;
}

.max-level-reached p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin: 0;
}

.cost-items-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.cost-item-upgrade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.cost-item-upgrade.sufficient {
  border-color: rgba(76, 175, 80, 0.5);
  background: rgba(76, 175, 80, 0.1);
}

.cost-item-upgrade.insufficient {
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.1);
}

.cost-item-upgrade .cost-value {
  font-size: 18px;
  font-weight: bold;
  color: #d4af37;
}

.cost-item-upgrade.insufficient .cost-value {
  color: #ff6b6b;
}

.cost-item-upgrade .cost-icon {
  font-size: 18px;
}

.cost-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.cost-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  font-size: 14px;
}

.cost-row span:first-child {
  font-weight: bold;
  flex: 1;
}

.cost-row span:last-child {
  font-size: 16px;
}

.cost-row.sufficient {
  color: #4caf50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.cost-row.insufficient {
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.btn-upgrade-level {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #9c27b0 0%, #6a1b9a 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.btn-upgrade-level:hover:not(.disabled) {
  box-shadow: 0 6px 16px rgba(156, 39, 176, 0.5);
  transform: translateY(-2px);
}

.btn-upgrade-level:active:not(.disabled) {
  transform: scale(0.95);
}

.btn-upgrade-level.disabled {
  background: linear-gradient(135deg, #999 0%, #666 100%);
  color: #ccc;
  opacity: 0.6;
  cursor: not-allowed;
}

/* ========================================
   WAREHOUSE MODAL STYLES
   ======================================== */

.warehouse-info-main {
  padding: 16px;
  background: linear-gradient(180deg, rgba(44, 59, 102, 0.34) 0%, rgba(18, 25, 46, 0.92) 100%);
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid rgba(99, 131, 204, 0.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 22px rgba(0,0,0,0.16);
}

.warehouse-level-display h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #fff;
}

.warehouse-resources-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 15px;
}

.warehouse-resource-item {
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  border: 1px solid rgba(99, 131, 204, 0.16);
}

.resource-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.resource-name {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.resource-amount {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.warehouse-progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(0, 0, 0, 0.26);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(99, 131, 204, 0.16);
}

.warehouse-upgrade-section {
  padding: 0;
}

.max-btn {
  padding: 6px 12px;
  background: rgba(76, 111, 166, 0.3);
  color: #fff;
  border: 1px solid rgba(76, 111, 166, 0.5);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.max-btn:hover {
  background: rgba(76, 111, 166, 0.5);
  border-color: rgba(76, 111, 166, 0.7);
}

.max-btn:active {
  transform: scale(0.95);
}
