/* ==========================================
   ROOM CARDS & MODAL SYSTEM
   ========================================== */

/* Rooms Container */
.rooms-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0;
  padding: 0 16px;
}

.empty-warehouse {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  opacity: 0.5;
}

.empty-warehouse .empty-state-icon {
  margin-bottom: 16px;
}

.room-decorations-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.room-decorations-title {
  font-size: 8px;
  color: var(--accent);
  margin-bottom: 6px;
}

.room-decorations-hint {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 10px;
}

.decoration-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.decoration-picker-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 88px;
  padding: 10px 8px;
  background: rgba(0,0,0,0.35);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}

.decoration-picker-btn img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.decoration-picker-btn span {
  font-size: 7px;
  font-family: var(--font-pixel);
  text-align: center;
}

.decoration-picker-btn:hover,
.decoration-picker-btn.placed {
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(0,200,5,0.25);
}

.decoration-picker-btn.placed {
  background: rgba(0,200,5,0.08);
}

/* Room Card */
.room-card {
  background: linear-gradient(180deg, rgba(0,200,5,0.08) 0%, rgba(10,10,10,0.95) 60%);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.room-card:hover {
  transform: translateY(-4px);
  border-color: var(--secondary);
  box-shadow: 0 8px 24px rgba(0,200,5,0.4);
}

.room-card.active-room {
  border-color: var(--secondary);
  box-shadow: 0 0 20px rgba(0,200,5,0.3);
}

.room-card.active-room::before {
  content: 'ACTIVE';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 7px;
  padding: 4px 8px;
  background: var(--secondary);
  color: var(--bg-dark);
  border-radius: 4px;
  font-family: var(--font-pixel);
}

/* Add Room Card */
.add-room-card {
  border-style: dashed;
  border-color: rgba(0,200,5,0.4);
  background: linear-gradient(180deg, rgba(0,200,5,0.04) 0%, rgba(10,10,10,0.8) 60%);
}

.add-room-card:hover {
  border-color: var(--primary);
  border-style: solid;
}

.add-room-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.add-room-card:hover .add-room-icon {
  opacity: 1;
}

/* Room Card Header */
.room-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.room-card-title {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--text-main);
}

.room-card-capacity {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--text-muted);
}

/* Room Visual */
.room-card-visual {
  width: 100%;
  height: 180px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.room-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
}

.room-card-visual.empty {
  background: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.02),
    rgba(255,255,255,0.02) 10px,
    transparent 10px,
    transparent 20px
  );
}

/* Miners Inside Room */
.room-miners-preview {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.room-miner-icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--secondary);
  background: rgba(0,200,5,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.room-miner-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Room Stats */
.room-card-stats {
  display: flex;
  gap: 12px;
  font-size: 8px;
}

.room-card-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.room-card-stat-label {
  color: var(--text-muted);
  text-transform: uppercase;
}

.room-card-stat-value {
  font-family: var(--font-pixel);
  color: var(--text-main);
  font-size: 9px;
}

.room-card-stat-value.gold {
  color: var(--accent);
}

/* ==========================================
   MODAL SYSTEM
   ========================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: #0b0b12;
  border: 2px solid var(--primary);
  border-radius: 16px;
  max-width: 600px;
  width: 90vw;
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9), 0 0 40px rgba(0,200,5,0.4);
  padding: 24px;
  opacity: 1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 14px;
  color: var(--accent);
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Room Modal Stats */
.room-modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.room-modal-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.room-modal-stat .label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.room-modal-stat .value {
  font-size: 12px;
  color: var(--text-main);
}

/* Miner Slots Grid */
.miner-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.miner-slot {
  aspect-ratio: 1;
  background: rgba(0,0,0,0.4);
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.miner-slot:hover {
  border-color: var(--primary);
  background: rgba(0,200,5,0.08);
}

.miner-slot.filled {
  border-style: solid;
  border-color: var(--secondary);
  background: linear-gradient(180deg, rgba(0,200,5,0.08) 0%, rgba(0,0,0,0.6) 60%);
}

.miner-slot.filled:hover {
  border-color: var(--danger);
}

.miner-slot-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 8px;
}

.miner-slot-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.miner-slot-label {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--text-muted);
  text-align: center;
}

.miner-slot.filled .miner-slot-label {
  color: var(--text-main);
}

.miner-slot-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.miner-slot.filled:hover .miner-slot-remove {
  display: flex;
}

/* Mining Controls */
.mining-controls {
  display: flex;
  gap: 12px;
  padding: 0 16px;
  margin: 24px 0;
}

.mining-controls .action-btn {
  flex: 1;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #ff6666;
  box-shadow: 0 6px 20px rgba(255,68,68,0.4);
}

/* Full width button */
.full-width {
  width: 100%;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .rooms-container {
    grid-template-columns: 1fr;
    padding: 0 12px;
  }

  .room-card-visual {
    height: 150px;
  }

  .modal-content {
    width: 95vw;
    padding: 16px;
  }

  .room-modal-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .miner-slots-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mining-controls {
    flex-wrap: wrap;
  }

  .mining-controls .action-btn {
    min-width: calc(50% - 6px);
  }
}
