/* Stats Modal Styles */

/* Utility Classes */
.hidden {
  display: none !important;
}

.modal-open {
  display: flex !important;
}

.body-modal-open {
  overflow: hidden !important;
}

.info-icon-container {
  position: absolute;
  bottom: 20px;
  left: 20px;
}

.info-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: white;
  border: 2px solid #6d6d6f;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-icon-btn:hover {
  background-color: #bbbbbb;
  border-color: #8a8a8a;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(149, 150, 150, 0.4);
}

.info-icon {
  filter: invert(30%);
  transition: filter 0.3s ease;
}

.info-icon img {
  display: block;
}

.info-icon-btn:hover .info-icon {
  filter: invert(100%);
}

/* Modal Styles */
.stats-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.stats-modal-content {
  background-color: white;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  animation: slideIn 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  font-family: "Libre Baskerville", serif;
  /* Asegurar que el modal no se salga de pantalla */
  margin: 0;
  position: relative;
}

.stats-modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 32px 16px 32px;
  border-bottom: 1px solid #f0f0f0;
}

.stats-modal-header h2 {
  margin: 0;
  color: var(--color-text-primary, #2c3e50);
  font-size: 1.3em;
  font-weight: 600;
  font-family: "Libre Baskerville", serif;
}

.stats-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: 2px solid var(--color-default-highlighted, #e6e6e6);
  color: var(--color-text-primary, #2c3e50);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 600;
  transition: all 0.2s ease;
  z-index: 100001;
  line-height: 1;
}

.stats-modal-close:hover {
  background: var(--color-negative-normal, #fc3d39);
  border-color: var(--color-negative-highlighted, #e33437);
  transform: scale(1.05);
}

.stats-modal-close-icon {
  width: 10px;
  height: 10px;
  filter: invert(30%);
  transition: all 0.2s ease;
}

.stats-modal-close:hover .stats-modal-close-icon {
  filter: invert(100%);
  transform: scale(1.2);
  translate: 0.35px 0px;
}

.stats-modal-body {
  padding: 24px 32px 32px 32px;
}

.stats-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px;
  background-color: #fafafa;
  border-radius: 8px;
  flex-wrap: wrap;
}

.stats-controls label {
  font-weight: 500;
  color: var(--color-text-primary, #2c3e50);
  font-size: 14px;
  font-family: "Libre Baskerville", serif;
}

/* Custom select for stats modal */
.stats-controls .custom-select {
  max-width: 160px;
  min-width: 160px;
}

.stats-controls .custom-select .select-button {
  padding: 8px 12px;
  font-size: 14px;
  height: auto;
  min-height: 36px;
}

.stats-controls .custom-select .select-dropdown {
  margin-top: 4px;
  max-height: 140px;
}

/* Button styling - now uses global btn classes */
.stats-controls .btn {
  font-size: 14px;
  min-width: 100px;
  padding: 8px 16px;
}

.stats-loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.stats-spinner {
  border: 3px solid #f0f0f0;
  border-top: 3px solid var(--color-recommended-normal, #5ba4fc);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

.stats-error {
  background-color: #fff5f5;
  border: 1px solid var(--color-negative-normal, #fc3d39);
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
  color: #c53030;
  font-size: 14px;
}

.stats-content {
  animation: fadeIn 0.5s ease;
}

.stats-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  transition: all 0.2s ease;
}

.stats-item:hover {
  background: #f5f5f5;
  transform: translateX(2px);
}

.stats-label {
  font-weight: 500;
  color: var(--color-text-primary, #2c3e50);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Libre Baskerville", serif;
}

.stats-value {
  font-weight: 600;
  color: var(--color-recommended-normal, #5ba4fc);
  font-size: 16px;
  font-family: "Libre Baskerville", serif;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .stats-modal {
    padding: 15px;
  }

  .stats-modal-content {
    width: 100%;
    max-width: none;
    max-height: calc(100vh - 30px);
  }

  .stats-modal-header {
    padding: 20px 24px 16px 24px;
  }

  .stats-modal-body {
    padding: 20px 24px 24px 24px;
  }

  .stats-controls {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .stats-controls .custom-select {
    max-width: 100%;
    min-width: 200px;
  }

  .info-icon-container {
    bottom: 15px;
    left: 15px;
  }

  .info-icon-btn {
    width: 28px;
    height: 28px;
  }

  .info-icon {
    font-size: 16px;
  }

  .stats-item {
    padding: 14px 16px;
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .stats-label {
    justify-content: center;
  }
}
