/* ===================================================================
   MORDHEIM - CONDITIONAL STATS STYLES
   Zeigt konditionale Stat-Modifikatoren visuell an
   Version 1.0
   =================================================================== */

/* ===================================================================
   STAT MIT KONDITIONALEN BONI
   =================================================================== */

.stat.has-conditional {
  position: relative;
  cursor: help;
  background: linear-gradient(135deg,
  rgba(255, 193, 7, 0.15) 0%,
  rgba(255, 152, 0, 0.1) 100%
  );
  border: 1px solid rgba(255, 193, 7, 0.4);
  border-radius: 4px;
  padding: 2px 6px 2px 4px;
  transition: all 0.2s ease;
}

.stat.has-conditional:hover {
  background: linear-gradient(135deg,
  rgba(255, 193, 7, 0.25) 0%,
  rgba(255, 152, 0, 0.2) 100%
  );
  border-color: rgba(255, 193, 7, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

/* Blitz-Indikator */
.cond-indicator {
  font-size: 0.65rem;
  margin-left: 2px;
  opacity: 0.8;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Kombinierte Klassen */
.stat.has-conditional.buffed {
  background: linear-gradient(135deg,
  rgba(76, 175, 80, 0.2) 0%,
  rgba(255, 193, 7, 0.15) 100%
  );
  border-color: rgba(129, 199, 132, 0.5);
}

.stat.has-conditional.nerfed {
  background: linear-gradient(135deg,
  rgba(244, 67, 54, 0.2) 0%,
  rgba(255, 193, 7, 0.15) 100%
  );
  border-color: rgba(244, 67, 54, 0.5);
}

/* ===================================================================
   INFO-BUTTON IN STATS ROW
   =================================================================== */

.cond-stats-info-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  margin-left: 8px;
  background: linear-gradient(135deg,
  rgba(255, 193, 7, 0.2) 0%,
  rgba(255, 152, 0, 0.15) 100%
  );
  border: 1px solid rgba(255, 193, 7, 0.5);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.75rem;
  color: #ffc107;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.cond-stats-info-btn:hover {
  background: linear-gradient(135deg,
  rgba(255, 193, 7, 0.35) 0%,
  rgba(255, 152, 0, 0.25) 100%
  );
  border-color: rgba(255, 193, 7, 0.8);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
}

.cond-stats-info-btn .info-icon {
  font-size: 0.9rem;
  animation: pulse-glow 2s ease-in-out infinite;
}

.cond-stats-info-btn .info-count {
  font-weight: 600;
  min-width: 14px;
  text-align: center;
}

/* ===================================================================
   DETAIL POPUP OVERLAY
   =================================================================== */

.cond-stats-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.cond-stats-popup-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* ===================================================================
   DETAIL POPUP CONTAINER
   =================================================================== */

.cond-stats-popup {
  background: linear-gradient(180deg, #1e1e1e 0%, #141414 100%);
  border: 2px solid #c9a959;
  border-radius: 12px;
  min-width: 350px;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(201, 169, 89, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.2s ease;
}

.cond-stats-popup-overlay.visible .cond-stats-popup {
  transform: scale(1) translateY(0);
}

/* ===================================================================
   POPUP HEADER
   =================================================================== */

.cond-popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(201, 169, 89, 0.15) 0%, transparent 100%);
  border-bottom: 1px solid rgba(201, 169, 89, 0.3);
}

.cond-popup-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #ffc107;
  font-weight: 600;
  flex-shrink: 0;
}

.cond-popup-unit {
  flex: 1;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cond-popup-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cond-popup-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: rotate(90deg);
}

/* ===================================================================
   POPUP OVERVIEW (MAX BONI)
   =================================================================== */

.cond-popup-overview {
  padding: 12px 20px;
  background: rgba(255, 193, 7, 0.08);
  border-bottom: 1px solid rgba(201, 169, 89, 0.2);
}

.cond-overview-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.cond-overview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cond-overview-stat {
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffc107;
}

/* ===================================================================
   POPUP BODY
   =================================================================== */

.cond-popup-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

/* Category */
.cond-popup-category {
  margin-bottom: 16px;
}

.cond-popup-category:last-child {
  margin-bottom: 0;
}

.cond-popup-category-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Item */
.cond-popup-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.cond-popup-item:last-child {
  margin-bottom: 0;
}

.cond-popup-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.cond-popup-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cond-popup-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.cond-popup-source {
  flex: 1;
  font-weight: 600;
  color: #fff;
}

.cond-popup-bonus {
  font-weight: 700;
  font-size: 0.9rem;
  padding: 3px 10px;
  border-radius: 4px;
}

.cond-popup-bonus.permanent {
  background: rgba(76, 175, 80, 0.2);
  color: #81c784;
  border: 1px solid rgba(76, 175, 80, 0.4);
}

.cond-popup-bonus.conditional {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.4);
}

.cond-popup-condition {
  margin-top: 6px;
  margin-left: 34px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

/* ===================================================================
   POPUP FOOTER (LEGENDE)
   =================================================================== */

.cond-popup-footer {
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(201, 169, 89, 0.2);
}

.cond-popup-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-item .dot.permanent {
  background: #81c784;
  box-shadow: 0 0 6px rgba(129, 199, 132, 0.5);
}

.legend-item .dot.conditional {
  background: #ffc107;
  box-shadow: 0 0 6px rgba(255, 193, 7, 0.5);
}

/* ===================================================================
   CARD STATS ROW - Verbessertes Layout
   =================================================================== */

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.card-stats .stat {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

/* ===================================================================
   PDF EXPORT STYLES
   =================================================================== */

.pdf-conditional-stats {
  font-size: 8pt;
  color: #555;
  background: #fffbf0;
  border: 1px solid #e0d0a0;
  border-radius: 4px;
  padding: 4px 8px;
  margin-top: 4px;
  margin-bottom: 4px;
}

/* ===================================================================
   RESPONSIVE ANPASSUNGEN
   =================================================================== */

@media (max-width: 768px) {
  .stat.has-conditional {
    padding: 1px 4px 1px 3px;
  }

  .cond-indicator {
    font-size: 0.55rem;
  }

  .cond-stats-info-btn {
    padding: 2px 6px;
    font-size: 0.7rem;
  }

  .cond-stats-popup {
    min-width: 90vw;
    max-width: 95vw;
    max-height: 90vh;
    margin: 10px;
  }

  .cond-popup-header {
    padding: 12px 16px;
  }

  .cond-popup-header h3 {
    font-size: 1rem;
  }

  .cond-popup-body {
    padding: 12px 16px;
  }

  .cond-popup-item {
    padding: 8px 10px;
  }
}

/* ===================================================================
   DARK MODE ANPASSUNGEN (falls Theme-Support)
   =================================================================== */

@media (prefers-color-scheme: dark) {
  .stat.has-conditional {
    background: linear-gradient(135deg,
    rgba(255, 193, 7, 0.12) 0%,
    rgba(255, 152, 0, 0.08) 100%
    );
  }
}

/* ===================================================================
   PRINT STYLES
   =================================================================== */

@media print {
  .stat.has-conditional {
    background: none;
    border: 1px dashed #999;
  }

  .cond-indicator {
    display: none;
  }

  .cond-stats-info-btn {
    display: none;
  }

  .cond-stats-popup-overlay {
    display: none !important;
  }

  .pdf-conditional-stats {
    background: none;
    border: 1px solid #ccc;
    color: #333;
  }
}

/* ===================================================================
   SCROLLBAR STYLING FÜR POPUP
   =================================================================== */

.cond-popup-body::-webkit-scrollbar {
  width: 8px;
}

.cond-popup-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.cond-popup-body::-webkit-scrollbar-thumb {
  background: rgba(201, 169, 89, 0.3);
  border-radius: 4px;
}

.cond-popup-body::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 169, 89, 0.5);
}

/* ===================================================================
   RW BREAKDOWN MODAL
   =================================================================== */

.stat.armor.rw-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.stat.armor.rw-clickable:hover {
  background: rgba(41, 128, 185, 0.45);
  transform: scale(1.08);
  box-shadow: 0 0 8px rgba(41, 128, 185, 0.4);
}

.rw-breakdown-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
}

.rw-breakdown-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rw-breakdown-icon {
  font-size: 1.15em;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.rw-breakdown-source {
  flex: 1;
  font-weight: 600;
  color: #e8dcc8;
  font-size: 0.95em;
}

.rw-breakdown-value {
  font-weight: 700;
  font-size: 0.9em;
  padding: 3px 10px;
  border-radius: 5px;
  min-width: 36px;
  text-align: center;
}

.rw-breakdown-value.permanent {
  background: rgba(42, 125, 42, 0.3);
  border: 1px solid rgba(42, 125, 42, 0.5);
  color: #6fcf6f;
}

.rw-breakdown-detail {
  margin-top: 4px;
  padding-left: 36px;
  font-size: 0.82em;
  color: #999;
  font-style: italic;
}

.rw-total {
  font-size: 1.2em !important;
  font-weight: 700;
  color: #5dade2;
  background: rgba(41, 128, 185, 0.2);
  border: 1px solid rgba(41, 128, 185, 0.4);
  padding: 4px 14px;
  border-radius: 6px;
}

.rw-breakdown-notes {
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rw-note {
  font-size: 0.82em;
  color: #b0a080;
  padding: 4px 0;
  line-height: 1.4;
}

.rw-note strong {
  color: #d4c4a0;
}
