/* Mobile PWA Full Screen Styles */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

body {
  position: fixed;
  width: 100%;
  height: 100%;
  font-family: sans-serif;
  background-color: #f0f0f0;
}

#app {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: none;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

header {
  flex-shrink: 0;
  background-color: #007bff;
  color: #fff;
  text-align: center;
  padding: 20px;
}

main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
}

section {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

section.hidden {
  display: none;
}

button {
  background-color: #007bff;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
  margin-right: 10px;
}

button:hover {
  background-color: #0056b3;
}

#pack-contents,
#player-hand,
#opponent-field,
#opponent-area > div > div { 
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start; 
}

.card {
  width: 150px;
  height: 220px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: #eee;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px;
  box-sizing: border-box;
  text-align: center;
  margin-bottom: 10px;
}

.card img {
  max-width: 100%;
  max-height: 60%;
  object-fit: contain;
}

.card-stats {
  font-size: 0.8em;
}

/* Add space between buttons in the deck building section */
#deck-building button {
  margin-right: 10px;
}

/* Rarity styling */
.card.common {
  border: 1px solid #999;
  background-color: #fff;
}

.card.uncommon {
  border: 1px solid #0f0;
  background-color: #dfd;
}

.card.rare {
  border: 1px solid #007bff;
  background-color: #ddf;
}

.card.legendary {
  border: 5px solid gold;
  background-color: #ffffe0;
  box-shadow: 0 0 15px gold;
}

.card.ultra-rare {
  border: 5px solid #ff69b4; /* Hot Pink */
  background-color: #ffe0f0; /* Light Pink */
  box-shadow: 0 0 15px #ff69b4;
}

.card.mythical {
  border: 5px solid #800080; /* Purple */
  background-color: #f0e0ff; /* Light Purple */
  box-shadow: 0 0 20px #800080;
}

.card.secret-rare {
  border: 7px solid gold; /* Changed border color */
  background-color: #000;
  box-shadow: 0 0 25px #000;
  color: gold; /* Changed text color */
}

.card.selected {
  border: 3px solid yellow; /* Example selection style */
  box-shadow: 0 0 10px yellow;
}

.card.defeated {
  animation: cardDefeat 0.5s ease-out forwards;
}

@keyframes cardDefeat {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}

#battle-score {
  display: flex;
  justify-content: space-around;
  margin-bottom: 10px;
  font-size: 1.1em;
}

#battle-score > div {
  padding: 10px;
  background-color: #e0e0e0;
  border-radius: 5px;
}

footer {
  flex-shrink: 0;
  text-align: center;
  padding: 10px;
  background-color: #f0f0f0;
  border-top: 1px solid #ddd;
}

#battle-log {
  margin-top: 20px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: #f9f9f9;
  height: 100px;
  overflow-y: scroll;
}

#collection-cards {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 20px;
  padding-bottom: 10px;
}

/* Deck cards now scroll horizontally */
#deck-cards {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding-bottom: 10px;
}

/* Collection cards now scroll horizontally like deck cards */
#full-collection-cards {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding-bottom: 10px;
  direction: rtl; 
}

/* Card index cards now scroll horizontally */
#card-index-cards {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding-bottom: 10px;
}

#deck-cards::-webkit-scrollbar,
#full-collection-cards::-webkit-scrollbar,
#card-index-cards::-webkit-scrollbar {
  height: 8px;
}

#deck-cards::-webkit-scrollbar-track,
#full-collection-cards::-webkit-scrollbar-track,
#card-index-cards::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

#deck-cards::-webkit-scrollbar-thumb,
#full-collection-cards::-webkit-scrollbar-thumb,
#card-index-cards::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

#deck-cards::-webkit-scrollbar-thumb:hover,
#full-collection-cards::-webkit-scrollbar-thumb:hover,
#card-index-cards::-webkit-scrollbar-thumb:hover {
  background: #555;
}

#currency-display {
  text-align: center;
  margin-bottom: 10px;
  font-size: 1.2em;
}

/* Online Battle Section Styles */
/* Make deck builder cards indicate they are clickable */
#collection-cards .card,
#deck-cards .card {
  cursor: pointer;
}

/* Online Battle Styles */
#online-battle-lobby {
  text-align: center;
  margin-bottom: 20px;
}

#online-battle-lobby input {
  padding: 10px;
  margin: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

#online-battle-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  padding: 10px;
  background-color: #f0f0f0;
  border-radius: 5px;
}

#online-deck-preview {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-bottom: 15px;
}

.deck-preview-card {
  min-width: 150px;
}

#online-battle-arena {
  margin-top: 20px;
}

#online-battle-score {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  padding: 10px;
  background-color: #e0e0e0;
  border-radius: 5px;
  font-weight: bold;
}

#online-opponent-area,
#online-player-area {
  margin-bottom: 15px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

#online-opponent-cards,
#online-player-hand {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding: 10px 0;
}

.playable-card {
  cursor: pointer;
  transition: transform 0.2s;
}

.playable-card:hover {
  transform: translateY(-5px);
}

.playable-card.selected {
  border: 3px solid #007bff;
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

#online-battle-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: center;
}

#online-battle-controls button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

#online-battle-log {
  height: 150px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 10px;
  background-color: #f9f9f9;
}

/* Battle Styles */
#battle-deck-selection {
  text-align: center;
  margin-bottom: 20px;
}

#battle-deck-preview {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-bottom: 15px;
}

.deck-preview-card {
  min-width: 150px;
}

#battle-arena {
  margin-top: 20px;
}

#bot-area,
#player-area {
  margin-bottom: 15px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

#bot-cards,
#player-hand {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding: 10px 0;
}

#bot-selection {
  text-align: center;
  margin-bottom: 20px;
}

#bot-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.bot-card {
  background-color: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.bot-card:hover {
  background-color: #e9ecef;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.bot-card h4 {
  margin: 0 0 10px 0;
  color: #007bff;
}

.bot-card p {
  margin: 5px 0;
  font-size: 14px;
}

.bot-card[data-bot="novice"] { border-color: #28a745; }
.bot-card[data-bot="amateur"] { border-color: #17a2b8; }
.bot-card[data-bot="pro"] { border-color: #ffc107; }
.bot-card[data-bot="expert"] { border-color: #fd7e14; }
.bot-card[data-bot="master"] { border-color: #dc3545; }
.bot-card[data-bot="champion"] { border-color: #6f42c1; }

#bot-name {
  font-weight: bold;
  color: #007bff;
}

#bot-field-name {
  font-weight: bold;
  color: #dc3545;
}

#battle-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: center;
}

#battle-controls button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

#battle-status {
  margin: 10px 0;
  padding: 10px;
  background-color: #e8f4f8;
  border-radius: 4px;
}

#searching-animation {
  text-align: center;
  padding: 20px;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 10px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#find-battle-button, #cancel-search-button {
  margin: 10px;
}

/* iOS PWA Safe Areas */
@supports (padding: max(0px)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* Prevent zoom on double-tap */
button, input, textarea {
  font-size: 16px !important;
}

/* Responsive card sizing */
@media (max-width: 480px) {
  .card {
    width: 120px;
    height: 180px;
    font-size: 0.8em;
  }
  
  #collection-cards,
  #deck-cards,
  #full-collection-cards,
  #card-index-cards {
    gap: 5px;
  }
}

/* Landscape orientation handling */
@media (orientation: landscape) and (max-height: 480px) {
  #app {
    overflow-y: auto;
  }
}