/* Estilos generales */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #a8e6cf 0%, #dcedc8 100%);
  min-height: 100vh;
  padding: 10px;
}

.container {
  max-width: 1024px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Header */
header {
  background: linear-gradient(135deg, #66bb6a 0%, #81c784 100%);
  color: white;
  padding: 15px;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  margin: 0 0 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Main content */
.main-content {
  padding: 10px;
}

.main-content .upper-container {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
}

/* Sección de precio de compra */
.buy-price-section {
  background: #bbd4ff;
  padding: 15px;
  border-radius: 15px;
  margin: 0 auto 15px;
  border: 3px solid #4d8eff;
}

h2.buy-price-title {
  color: #005eff;
  margin: 0 0 15px;
  font-size: 1.5rem;
}

.buy-price-section .helper-text {
  display: block;
  margin: 10px 0 0;
  color: #005eff;
  font-size: 0.9rem;
  text-align: center;
  font-style: italic;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-group input {
  flex: 1;
  max-width: 200px;
  padding: 15px;
  font-size: 1.2rem;
  border: 2px solid #4d8eff;
  background: #bbd4ff;
  border-radius: 10px;
  text-align: center;
  color: #005eff;
  font-weight: bold;
}

.input-group input:disabled {
  background: #e3f2fd;
  color: #90caf9;
  cursor: not-allowed;
  border-color: #bbdefb;
}

.bayas {
  font-weight: bold;
  color: #005eff;
  font-size: 1.1rem;
}

/* Sección de patrón anterior */
.previous-pattern-section {
  background: #ffe6b3;
  padding: 15px;
  border-radius: 15px;
  margin: 0 auto 15px;
  border: 3px solid #ff9800;
}

h2.previous-pattern-title {
  color: #e65100;
  margin: 0 0 15px;
  font-size: 1.5rem;
}

.previous-pattern-section .input-group select {
  flex: 1;
  max-width: 300px;
  padding: 15px;
  font-size: 1.1rem;
  border: 2px solid #ff9800;
  background: #fff8e1;
  border-radius: 10px;
  color: #e65100;
  font-weight: bold;
  cursor: pointer;
}

.previous-pattern-section .input-group select:disabled {
  background: #fff3e0;
  color: #ffb74d;
  cursor: not-allowed;
  border-color: #ffe0b2;
}

.previous-pattern-section .helper-text {
  display: block;
  margin: 10px 0 0;
  color: #e65100;
  font-size: 0.9rem;
  text-align: center;
  font-style: italic;
}

/* Sección de precios de la semana */
.week-prices-section h2 {
  color: #2e7d32;
  margin: 0 0 20px;
  font-size: 1.5rem;
}

.prices-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.day-group {
  width: 150px;
  background: #f1f8e9;
  padding: 5px 10px;
  border-radius: 12px;
  border: 2px solid #aed581;
}

.day-group h3 {
  color: #558b2f;
  margin: 0 0 15px;
  font-size: 1.1rem;
  text-align: center;
}

.price-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  position: relative;
}

.price-input:last-child {
  margin: 0;
}

.price-input label {
  font-weight: bold;
  color: #558b2f;
  min-width: 35px;
}

.price-input input {
  flex: 1;
  width: 100%;
  padding: 5px 0;
  border: 2px solid #aed581;
  border-radius: 8px;
  text-align: center;
  font-size: 1rem;
}

.price-input input:focus {
  outline: none;
  border-color: #66bb6a;
  box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.1);
}

.price-input input:disabled {
  background: #f5f5f5;
  color: #9e9e9e;
  cursor: not-allowed;
  border-color: #e0e0e0;
}

/* Estilos para valores estimados y confirmados */
.price-input input.estimated-value {
  background: #fff3e0;
  color: #e65100;
  border-color: #ffb74d;
  font-style: italic;
}

.price-input input.estimated-value::placeholder {
  color: #e65100;
  opacity: 1;
  font-style: italic;
  font-weight: normal;
}

.price-input input.estimated-value:hover {
  background: #ffe0b2;
  cursor: pointer;
  border-color: #ff9800;
}

.price-input input.confirmed-value {
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: bold;
  border-color: #81c784;
}

.price-input input.confirmed-value:hover {
  background: #c8e6c9;
  border-color: #66bb6a;
}

/* Rate badge */
.rate-badge {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(35%,-35%);
  font-size: 0.55rem;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 12px;
  white-space: nowrap;
  text-align: center;
  display: inline-block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.rate-badge.rising {
  background: #c8e6c9;
  color: #2e7d32;
}

.rate-badge.falling {
  background: #ffcdd2;
  color: #c62828;
}

.rate-badge.neutral {
  background: #e0e0e0;
  color: #616161;
}

.rate-badge:empty {
  display: none;
}

/* Best selling time glow */
input.best-selling-time {
  animation: golden-glow 2s ease-in-out infinite;
  position: relative;
}

@keyframes golden-glow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5),
                0 0 12px rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
  }
  50% {
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.8),
                0 0 24px rgba(255, 215, 0, 0.4);
    border-color: #ffed4e;
  }
}

/* Indicador de rango */
.range-indicator {
  font-size: 0.75rem;
  color: #e65100;
  text-align: center;
  margin: 2px 0 0;
  font-style: italic;
}

/* Botones */
.button-group {
  margin-top: 15px;
  display: flex;
  gap: 15px;
  justify-content: center;
}

button {
  padding: 15px 30px;
  font-size: 1.1rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #66bb6a 0%, #81c784 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 187, 106, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 187, 106, 0.4);
}

.btn-secondary {
  background: #e0e0e0;
  color: #616161;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.btn-share {
  background: #6a87ff;
  color: white;
}

.btn-share:hover {
  background: #d0d0d0;
}

/* Sección de resultados */
.results-section {
  margin: 30px auto 0;
  padding: 10px;
  background: #e8f5e9;
  border-radius: 15px;
  border: 3px solid #66bb6a;
}

.results-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
  margin: 20px 0 0;
}

.results-main {
  min-width: 0;
}

.results-section h2 {
  color: #2e7d32;
  margin: 0 0 20px;
  font-size: 1.8rem;
}

/* Badge del patrón */
.pattern-badge {
  display: block;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 1.05rem;
  margin: 0 0 20px;
  text-align: center;
}

.pattern-compact {
  line-height: 1.5;
}

.pattern-compact strong {
  font-size: 1.2rem;
}

.pattern-alternatives {
  margin: 12px 0 0;
  text-align: center;
  color: #616161;
  font-size: 0.95rem;
  line-height: 1.5;
}

.pattern-alternatives strong {
  color: #424242;
}

.pattern-explanation {
  background: #f5f5f5;
  padding: 12px 20px;
  border-radius: 8px;
  margin: 0 0 20px;
  text-align: center;
  border-left: 4px solid #66bb6a;
}

.pattern-explanation small {
  color: #616161;
  line-height: 1.6;
}

.pattern-explanation strong {
  color: #424242;
}

/* Distribución de probabilidades */
.probability-distribution {
  background: #f9fbe7;
  padding: 15px;
  border-radius: 10px;
  border: 2px solid #aed581;
}

.probability-distribution h4 {
  color: #558b2f;
  font-size: 1rem;
  margin: 0 0 12px;
  text-align: center;
}

.probability-title {
  margin: 25px 0 0;
}

.probability-explanation {
  text-align: center;
  margin: 15px auto 12px;
  color: #616161;
  line-height: 1.4;
}

.probability-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.probability-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  background: white;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.probability-item:hover {
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.probability-item.primary-pattern {
  background: #e8f5e9;
  border: 2px solid #66bb6a;
  box-shadow: 0 3px 10px rgba(102, 187, 106, 0.3);
}

.probability-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 5px;
}

.probability-name {
  font-size: 0.95rem;
  font-weight: bold;
  color: #424242;
}

.primary-pattern .probability-name {
  color: #2e7d32;
  font-size: 1rem;
}

.primary-badge {
  background: #66bb6a;
  color: white;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.probability-bar-container {
  position: relative;
  width: 100%;
  height: 28px;
  background: #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.probability-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #81c784 0%, #aed581 100%);
  transition: width 0.5s ease;
  border-radius: 8px;
}

.primary-pattern .probability-bar-fill {
  background: linear-gradient(90deg, #66bb6a 0%, #81c784 100%);
}

.probability-value {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  font-weight: bold;
  color: #424242;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
}

/* Mejor momento para vender */
.best-time {
  background: linear-gradient(135deg, #fff9c4 0%, #ffeb3b 100%);
  padding: 20px;
  border-radius: 10px;
  border: 3px solid #fbc02d;
  text-align: center;
}

.best-time h3 {
  color: #f57f17;
  margin: 0 0 10px;
  font-size: 1.4rem;
}

.best-time p {
  font-size: 1.1rem;
  color: #e65100;
  font-weight: bold;
}

/* Footer */
footer {
  background: #f5f5f5;
  padding: 20px;
  text-align: center;
  color: #757575;
}

footer p {
  margin: 5px 0;
}

.credits {
  font-size: 0.9rem;
  margin: 10px 0 0;
}

/* Responsive */
/* Tablets: 2 columnas */
@media (max-width: 1024px) {

  .inputs-section {
    display: flex;
    justify-content: space-around;
  }

  .day-group {
    width: auto;
  }

  .results-section {
    max-width: none;
  }

  .main-content .upper-container {
    flex-direction: column;
    align-items: unset;
  }
}
@media (max-width: 878px) {

  .inputs-section {
    flex-direction: column;
  }
}

@media (max-width: 768px) {

  .results-grid {
    grid-template-columns: 1fr;
  }
}

/* Móviles: 1 columna */
@media (max-width: 425px) {
  header h1 {
    font-size: 2rem;
  }

  .prices-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .button-group {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .legend {
    flex-direction: column;
  }
}

@media (max-width: 320px) {
  .prices-grid {
    grid-template-columns: 1fr;
  }
}

/* Animaciones */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Sección de debugging */
.debug-info {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 20px;
  margin: 0;
}

.debug-info h3 {
  color: #495057;
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 1.1em;
}

.debug-info h3:first-child {
  margin-top: 0;
}

.debug-info p {
  margin-top: 0;
  margin-bottom: 10px;
  color: #6c757d;
}

.rejection-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.rejection-list>li {
  background: white;
  border-left: 3px solid #6c757d;
  padding: 10px 15px;
  margin-bottom: 10px;
  border-radius: 4px;
}

.rejection-list>li.primary-pattern {
  border-left-color: #66bb6a;
}

.rejection-list>li.unlikely-pattern {
  border-left-color: #ffa726;
}

.rejection-list>li>ul {
  margin-top: 8px;
  margin-bottom: 0;
  padding-left: 20px;
  color: #6c757d;
  font-size: 0.9em;
}

.rejection-list>li>ul>li {
  margin-bottom: 4px;
}