/* ========================================
   RESEARCH - Recherche et upgrades
   ======================================== */

/* Bouton de recherche */
.btn-research-toggle {
  position: relative;
  z-index: 1;
  padding: 8px 15px;
  background: #3a3a4a;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.btn-research-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(58, 58, 74, 0.5);
  background: #4a4a5a;
}

/* Bouton Toggle Auras */
.btn-aura-toggle {
  position: relative;
  z-index: 1;
  padding: 8px 15px;
  background: linear-gradient(135deg, #2a4a6a 0%, #1a3a5a 100%);
  color: white;
  border: 2px solid #3a6a9a;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 8px rgba(58, 106, 154, 0.3);
}

.btn-aura-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(58, 106, 154, 0.5);
  background: linear-gradient(135deg, #3a5a7a 0%, #2a4a6a 100%);
  border-color: #5a8aba;
}

.btn-aura-toggle.active {
  background: linear-gradient(135deg, #2a7a5a 0%, #1a6a4a 100%);
  border-color: #4aba8a;
  box-shadow: 0 0 15px rgba(74, 186, 138, 0.4), inset 0 0 10px rgba(74, 186, 138, 0.2);
}

/* Bouton Toggle Tours */
.btn-towers-toggle {
  position: relative;
  z-index: 1;
  padding: 10px 15px;
  background: linear-gradient(135deg, #5a4a2a 0%, #4a3a1a 100%);
  color: white;
  border: 2px solid #8a7a4a;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.3s ease;
  flex: 0 1 auto;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 8px rgba(138, 122, 74, 0.3);
}

.btn-towers-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(138, 122, 74, 0.5);
  background: linear-gradient(135deg, #6a5a3a 0%, #5a4a2a 100%);
  border-color: #aa9a6a;
}

/* Bouton gestion des tours en header */
.btn-towers-header {
  width: 100%;
  padding: 12px 10px;
  background: linear-gradient(135deg, #2a2a4a 0%, #1a1a3a 100%);
  color: #ffd700;
  border: 2px solid #3a3a6a;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1em;
  transition: all 0.3s ease;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
  margin-bottom: 5px;
}

.btn-towers-header:hover {
  background: linear-gradient(135deg, #3a3a5a 0%, #2a2a4a 100%);
  border-color: #5a5a8a;
  box-shadow: 0 4px 15px rgba(58, 58, 106, 0.4);
  transform: scale(1.02);
}

/* Bouton portées */
.btn-range-toggle {
  background: #3498db;
  color: white;
  padding: 8px 12px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-range-toggle:hover {
  background: #2980b9;
  transform: scale(1.05);
}

.btn-range-toggle.active {
  background: #27ae60;
  box-shadow: 0 0 10px rgba(39, 174, 96, 0.5);
}

/* Research item styles */
.research-item.maxed {
  background: rgba(80, 80, 80, 0.5);
  border-color: #888;
  filter: grayscale(0.4) brightness(0.8);
  opacity: 0.85;
  pointer-events: none;
  position: relative;
}

.research-item.maxed .research-level {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #1a1a2e;
  border: 2px solid #ffd700;
}

.research-max {
  display: block;
  text-align: center;
  color: #ffd700;
  font-weight: bold;
  font-size: 1.1em;
  letter-spacing: 1px;
  margin-top: 8px;
  text-shadow: 0 0 8px #ffed4e, 0 2px 8px #000;
}

.research-level {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffd700;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  border: 1px solid #ffd700;
}
/* ========================================
   MODAL RECHERCHE
   ======================================== */

.research-modal {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
}

.research-modal.hidden {
  display: none !important;
}

.research-modal-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 3px solid #667eea;
  padding: 30px;
  border-radius: 15px;
  max-width: 950px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8), 0 0 40px rgba(102, 126, 234, 0.3);
  color: #ecf0f1;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.research-header-modal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 3px solid #667eea;
  padding-bottom: 15px;
}

.research-header-modal h2 {
  color: #ffd700;
  font-size: 2em;
  margin: 0;
  text-shadow: 0 2px 15px rgba(255, 215, 0, 0.5);
}

.btn-close-modal {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  border: none;
  color: white;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.btn-close-modal:hover {
  background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6);
}

/* Barre de progression recherche en cours */
.research-progress-section {
  background: rgba(102, 126, 234, 0.15);
  border: 2px solid #667eea;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
}

.research-progress-section.hidden {
  display: none;
}

.research-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.research-progress-name {
  color: #ffd700;
  font-weight: bold;
  font-size: 1.1em;
}

.research-progress-bar-main {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 25px;
  height: 30px;
  overflow: hidden;
  border: 2px solid #667eea;
}

.research-progress-fill {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 25px;
  box-shadow: 0 0 15px rgba(102, 126, 234, 0.6);
}

.research-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 0.9em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Contenu recherche */
.research-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
}

.research-category h4 {
  color: #ffd700;
  margin-bottom: 15px;
  font-size: 1.4em;
  text-align: center;
  text-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.research-item {
  background: rgba(15, 52, 96, 0.6);
  border: 2px solid #0f3460;
  padding: 18px;
  border-radius: 12px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.research-item:hover:not(.maxed) {
  background: rgba(15, 52, 96, 0.8);
  border-color: #667eea;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.research-item.maxed {
  background: rgba(80, 80, 80, 0.5);
  border-color: #888;
  filter: grayscale(0.4) brightness(0.8);
  opacity: 0.85;
  pointer-events: none;
  cursor: default;
}

.research-item.maxed .research-level {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #1a1a2e;
  border: 2px solid #ffd700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

/* Header de chaque item */
.research-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.research-icon {
  font-size: 2em;
  flex-shrink: 0;
}

.research-name {
  flex: 1;
  font-weight: bold;
  color: #ecf0f1;
  font-size: 1.1em;
}

.research-level {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #1a1a2e;
  padding: 5px 12px;
  border-radius: 15px;
  font-weight: bold;
  font-size: 0.9em;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* Stats actuelles et futures */
.research-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  border: 2px solid rgba(102, 126, 234, 0.3);
}

.current-bonus {
  font-weight: bold;
  color: #27ae60;
  font-size: 1.2em;
  text-shadow: 0 0 10px rgba(39, 174, 96, 0.6);
}

.next-bonus {
  color: #95a5a6;
  font-size: 1em;
  font-style: italic;
}

/* Barre de progression par item */
.research-progress-bar {
  position: relative;
  height: 28px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 2px solid #27ae60;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #27ae60 0%, #2ecc71 50%, #27ae60 100%);
  background-size: 200% 100%;
  animation: progressShine 2s linear infinite;
  transition: width 0.3s ease;
  box-shadow: 0 0 15px rgba(39, 174, 96, 0.5);
}

@keyframes progressShine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 0.9em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  z-index: 1;
}

/* Bouton de recherche */
.btn-research {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1em;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-research:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
  background: linear-gradient(135deg, #7889ef 0%, #8e5cb8 100%);
}

.btn-research.cancel {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  box-shadow: 0 4px 10px rgba(231, 76, 60, 0.3);
}

.btn-research.cancel:hover {
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
  background: linear-gradient(135deg, #ec7063 0%, #d35400 100%);
}

/* Item en cours de recherche */
.research-item.in-progress {
  border-color: #27ae60;
  box-shadow: 0 0 20px rgba(39, 174, 96, 0.4);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0%, 100% {
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(39, 174, 96, 0.7);
  }
}
