/* ============================================
   Mini Game Bay - UI Components
   ============================================ */

/* ============ CARDS ============ */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1.5rem; transition: var(--transition); }

/* ============ GAME CARD ============ */
.game-card {
  cursor: pointer; position: relative; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 1rem 1.25rem; transition: var(--transition);
}
.game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent-primary); }
.game-card-row { display: flex; align-items: center; gap: 0.75rem; }
.game-card-icon { font-size: 2.5rem; flex-shrink: 0; margin-bottom: 0; }
.game-card-body { flex: 1; min-width: 0; }
.game-card-header { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.2rem; }
.game-card-title { font-size: 1.1rem; font-weight: 600; flex: 1; min-width: 0; }
.game-card-actions { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
.game-card-info-btn, .game-card-pin-btn {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border-color); background: var(--bg-secondary);
  color: var(--text-muted); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; padding: 0; line-height: 1;
  transition: var(--transition); touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.game-card-info-btn:hover, .game-card-pin-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.game-card-pin-btn.pinned {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.game-card-info-btn .ph, .game-card-pin-btn .ph { font-size: 16px; }
.game-card-desc { color: var(--text-secondary); font-size: 0.8rem; margin: 0.4rem 0 0; }
.game-card-levels { color: var(--text-muted); font-size: 0.78rem; }
.game-card-badge { position: absolute; top: 10px; right: 10px; font-size: 1.1rem; }
.game-card.pinned { border-color: var(--accent-primary); }

/* ============ GAMES SECTIONS ============ */
.games-section { margin-bottom: 1.75rem; }
.games-section-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1.2rem; font-weight: 600; margin-bottom: 0.75rem;
  color: var(--text-primary);
}


/* ============ LEVEL CARD & SECTIONS ============ */
.levels-section { margin-bottom: 1.75rem; }
.levels-section-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1.15rem; font-weight: 600; margin-bottom: 0.85rem;
  color: var(--text-primary);
}

.level-card {
  cursor: pointer; text-align: center; position: relative;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 0.75rem 0.5rem; transition: var(--transition);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
}
.level-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.level-card.locked { opacity: 0.5; cursor: not-allowed; }
.level-card.completed { border-color: var(--accent-success); }
.level-card.active-level {
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}
.level-active-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--accent-primary);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 1;
}
.level-number { font-size: 1.8rem; font-weight: 700; color: var(--accent-primary); line-height: 1.1; }
.level-name { font-size: 0.85rem; margin: 0.2rem 0 0.1rem; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.best-record { font-size: 0.72rem; color: var(--text-muted); line-height: 1.2; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stars { color: var(--accent-warning); font-size: 1rem; margin-top: 0.15rem; line-height: 1; }

/* ============ STAT CARD ============ */
.stat-card { text-align: center; padding: 1.25rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); }
.stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ============ BUTTONS ============ */
.btn {
  padding: 0.6rem 1.25rem; border-radius: var(--radius-sm); border: none;
  cursor: pointer; font-size: 0.9rem; font-weight: 600;
  transition: var(--transition); display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-primary { background: var(--accent-primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-success { background: var(--accent-success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--accent-danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-warning { background: var(--accent-warning); color: #000; }
.btn-warning:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-secondary); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.modal-buttons { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

/* ============ POWER UPS ============ */
.powerups-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.powerup-btn {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  color: var(--text-primary); padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.85rem; transition: var(--transition);
  display: flex; align-items: center; gap: 0.3rem;
}
.powerup-btn:hover { background: var(--bg-card); }
.powerup-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.powerup-count {
  background: var(--accent-primary); color: #fff; border-radius: 50%;
  width: 20px; height: 20px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700;
}
.nav-powerups .powerup-btn > .ph,
.nav-powerups .powerup-btn > .ph-fill {
  flex: 0 0 1.25rem;
  font-size: 1.25rem;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9));
}
.nav-powerups .powerup-btn:disabled { opacity: 0.8; background: var(--bg-card); }

/* ============ ACTIVE SHIELD IN NAVBAR ============ */
.shield-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
}

.shield-active-badge {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -46%);
  font-size: 0.62rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 2px #000000, 0 1px 2px #000000;
  pointer-events: none;
  line-height: 1;
  z-index: 2;
}

.shield-icon-wrapper.has-active .ph-shield,
.shield-icon-wrapper.has-active .ph-fill.ph-shield {
  color: #38bdf8 !important;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.85)) !important;
  animation: shieldPulse 1.8s infinite ease-in-out;
}

@keyframes shieldPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.7)); }
  50% { transform: scale(1.12); filter: drop-shadow(0 0 10px rgba(56, 189, 248, 1)); }
}

/* ============ HINT HISTORY ============ */
.hint-history-btn {
  padding: 0.5rem 0.65rem !important;
  font-size: 0.9rem !important;
  background: rgba(108,99,255,0.15) !important;
  border-color: var(--accent-primary) !important;
}
.hint-history-btn:hover {
  background: rgba(108,99,255,0.3) !important;
}
.hint-history-card {
  max-width: 480px !important;
  max-height: 80vh;
  overflow-y: auto;
}
.hint-history-overlay {
  z-index: 2100;
}
.hint-history-list {
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}
.hint-history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}
.hint-history-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}
.hint-history-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
  padding-top: 3px;
}

/* ============ SETTINGS ============ */
.settings-section { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); }
.settings-section h3 { margin-bottom: 1rem; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; }
.setting-label { font-weight: 600; }
.setting-desc { font-size: 0.8rem; color: var(--text-muted); }
.theme-selector { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.theme-option {
  padding: 0.6rem 1rem; border-radius: var(--radius-sm); cursor: pointer;
  border: 2px solid var(--border-color); background: var(--bg-card);
  color: var(--text-primary); transition: var(--transition); font-size: 0.85rem; font-weight: 600;
}
.theme-option:hover { border-color: var(--accent-primary); }
.theme-option.selected { border-color: var(--accent-primary); background: var(--accent-primary); color: #fff; }

/* ============ TOGGLE SWITCH ============ */
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border-color); transition: 0.3s; border-radius: 26px;
}
.toggle-slider:before {
  position: absolute; content: ""; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background: #fff; transition: 0.3s; border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-success); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }

/* ============ PROGRESS BAR ============ */
.progress-bar { height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--gradient-primary); border-radius: 3px; transition: width 0.5s ease; }

/* ============ RESULT MODAL ============ */
.result-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85); display: flex; align-items: center;
  justify-content: center; z-index: 2000;
}
.result-card {
  background: var(--bg-card); border: 2px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 2rem; text-align: center;
  max-width: 400px; width: 90%; box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}
.result-card.win { border-color: var(--accent-success); }
.result-card.lose { border-color: var(--accent-danger); }
.result-icon { font-size: 4rem; margin-bottom: 0.5rem; }
.result-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
.result-details { margin: 1rem 0; }
.result-details p { margin: 0.3rem 0; color: var(--text-secondary); }
.result-details span { color: var(--text-primary); font-weight: 600; }

/* ============ NOTIFICATIONS ============ */
.notification {
  position: fixed; top: 80px; right: 20px; padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm); color: #fff; font-weight: 600;
  z-index: 3000; animation: slideIn 0.3s ease; box-shadow: var(--shadow);
  max-width: calc(100vw - 40px);
  word-break: break-word;
}
.notification.info { background: var(--accent-info); }
.notification.success { background: var(--accent-success); }
.notification.warning { background: var(--accent-warning); color: #000; }
.notification.error { background: var(--accent-danger); }

/* ============ GAME INFO ============ */
.game-info { display: flex; gap: 1rem; align-items: center; color: var(--text-secondary); font-size: 0.85rem; }