/* dados.css - VERSIÓN COMPLETA OPTIMIZADA PARA MÓVILES */
/* Estilos específicos para el simulador de dados con configuración individual */

/* Panel de configuración */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.config-group {
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.config-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: bold;
  color: var(--light-color);
  font-size: 0.9rem;
}

/* Controles principales */
.main-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-selector {
  display: flex;
  gap: 8px;
  margin-top: 5px;
}

.mode-btn {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(255, 107, 53, 0.3);
}

.number-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.number-input {
  width: 70px;
  padding: 8px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid var(--primary-color);
  border-radius: 6px;
  color: white;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.range-slider {
  margin-top: 8px;
}

.range-slider input[type='range'] {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

.range-slider input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
}

/* Secciones de configuración */
.config-section {
  background: rgba(255, 255, 255, 0.03);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: fadeIn 0.3s ease;
}

.faces-selector select {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid var(--primary-color);
  border-radius: 6px;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Configuración individual de dados */
.individual-dice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 5px;
}

.dice-config-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.dice-config-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
}

.dice-number {
  font-weight: bold;
  color: var(--primary-color);
  min-width: 60px;
  font-size: 0.9rem;
}

.dice-face-select {
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--primary-color);
  border-radius: 5px;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  border-radius: 5px;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
}

.btn-icon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Preconfiguraciones rápidas */
.quick-presets {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.quick-presets label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  opacity: 0.9;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-btn {
  flex: 1;
  min-width: 100px;
  padding: 8px 12px;
  background: rgba(52, 152, 219, 0.1);
  border: 1px solid rgba(52, 152, 219, 0.3);
  font-size: 0.8rem;
  color: white;
  cursor: pointer;
  border-radius: 5px;
}

.preset-btn:hover {
  background: rgba(52, 152, 219, 0.2);
  border-color: var(--info-color);
}

/* Área de lanzamiento */
.roll-area {
  margin: 20px 0;
}

.roll-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn-roll {
  font-size: 1.1rem;
  padding: 12px 24px;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  border: none;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
  color: white;
  cursor: pointer;
  border-radius: 8px;
}

.btn-roll:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

/* Resultados */
.results-section {
  text-align: center;
  padding: 15px;
}

.total-display {
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(255, 107, 53, 0.15);
  border-radius: 12px;
  border: 2px solid var(--primary-color);
  backdrop-filter: blur(5px);
}

.total-display h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  opacity: 0.9;
  color: white;
}

.total-number {
  font-size: 3.5rem;
  font-weight: bold;
  color: var(--primary-color);
  text-shadow: 0 0 25px rgba(255, 107, 53, 0.7);
  margin: 5px 0;
  letter-spacing: 1px;
}

/* Contenedor de dados */
.dice-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin: 20px 0;
  min-height: 120px;
  padding: 10px;
}

.dice-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0.5;
  color: rgba(255, 255, 255, 0.5);
}

.dice-placeholder i {
  font-size: 2rem;
  margin-bottom: 8px;
}

.dice-placeholder p {
  font-size: 0.85rem;
  text-align: center;
}

/* Dados individuales */
.dice {
  width: 70px;
  height: 70px;
  background: linear-gradient(145deg, #ffffff, #e6e6e6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: bold;
  color: #333;
  box-shadow:
    0 6px 15px rgba(0, 0, 0, 0.3),
    inset 0 -3px 5px rgba(0, 0, 0, 0.2),
    inset 0 3px 5px rgba(255, 255, 255, 0.8);
  border: 3px solid var(--primary-color);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.dice::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 6px;
}

.dice::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    transparent 30%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 70%
  );
}

/* Colores por tipo de dado */
.dice.d4 {
  background: linear-gradient(145deg, #ff6b6b, #ee5a52);
}
.dice.d6 {
  background: linear-gradient(145deg, #48dbfb, #0abde3);
}
.dice.d8 {
  background: linear-gradient(145deg, #1dd1a1, #10ac84);
}
.dice.d10 {
  background: linear-gradient(145deg, #f368e0, #ff9ff3);
}
.dice.d12 {
  background: linear-gradient(145deg, #ff9f43, #feca57);
}
.dice.d20 {
  background: linear-gradient(145deg, #54a0ff, #2e86de);
}
.dice.d100 {
  background: linear-gradient(145deg, #5f27cd, #341f97);
}

/* Área de resultados individuales */
.dice-result-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
}

.dice-type-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 10px;
  position: absolute;
  top: -10px;
  white-space: nowrap;
}

/* Información de rollos */
.roll-info {
  display: flex;
  justify-content: space-around;
  margin-top: 15px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  flex-wrap: wrap;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 5px 10px;
  color: rgba(255, 255, 255, 0.9);
}

.info-item i {
  color: var(--primary-color);
  font-size: 0.9rem;
}

.info-item strong {
  color: var(--primary-color);
  font-weight: bold;
  font-size: 1rem;
}

/* Controles de historial */
.history-controls-section {
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.history-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* Historial de lanzamientos */
.history-panel {
  margin-top: 20px;
}

.history-panel h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: white;
}

.roll-history-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  color: white;
}

.roll-history-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.roll-dice-values {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dice-mini {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  color: white;
  position: relative;
}

.mini-type {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  opacity: 0.7;
  white-space: nowrap;
}

/* Colores para dados mini en historial */
.dice-mini.d4 {
  background: linear-gradient(145deg, #ff6b6b, #ee5a52);
}
.dice-mini.d6 {
  background: linear-gradient(145deg, #48dbfb, #0abde3);
}
.dice-mini.d8 {
  background: linear-gradient(145deg, #1dd1a1, #10ac84);
}
.dice-mini.d10 {
  background: linear-gradient(145deg, #f368e0, #ff9ff3);
}
.dice-mini.d12 {
  background: linear-gradient(145deg, #ff9f43, #feca57);
}
.dice-mini.d20 {
  background: linear-gradient(145deg, #54a0ff, #2e86de);
}
.dice-mini.d100 {
  background: linear-gradient(145deg, #5f27cd, #341f97);
}

.roll-total {
  font-weight: bold;
  font-size: 1rem;
  color: var(--primary-color);
  min-width: 40px;
  text-align: center;
}

.roll-time {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.7);
}

.empty-history {
  text-align: center;
  padding: 20px;
  opacity: 0.7;
  font-style: italic;
  color: rgba(255, 255, 255, 0.7);
}

.empty-history i {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--primary-color);
}

/* Estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  flex-shrink: 0;
}

.stat-info h4 {
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: white;
}

.stat-info p {
  font-size: 0.8rem;
  opacity: 0.8;
  margin: 0;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.9);
}

/* Información educativa */
.info-card {
  margin-top: 20px;
}

.info-card h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: white;
}

.fun-facts {
  padding: 12px;
}

.fun-facts p {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.9);
}

.fun-facts p:last-child {
  border-bottom: none;
}

.fun-facts i {
  color: var(--primary-color);
  font-size: 0.8rem;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Sección de compartir */
.share-section {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Scrollbar personalizado */
.individual-dice-list::-webkit-scrollbar {
  width: 6px;
}

.individual-dice-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.individual-dice-list::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 3px;
}

/* MODOS ESPECÍFICOS PARA ORIENTACIÓN */

/* Modo Horizontal (Landscape) - Pantallas pequeñas */
@media (orientation: landscape) and (max-height: 600px) {
  .container {
    padding: 10px !important;
    max-width: 100% !important;
  }

  .app-header {
    min-height: 80px !important;
    margin-bottom: 15px;
  }

  .header-content {
    padding: 10px 15px;
    min-height: 80px;
  }

  .header-left h1 {
    font-size: 1.3rem !important;
  }

  .header-left .subtitle {
    font-size: 0.75rem !important;
  }

  .clock-container {
    padding: 6px 10px !important;
    min-width: 120px !important;
  }

  .clock-container #clock {
    font-size: 1rem !important;
  }

  .clock-container #date {
    font-size: 0.75rem !important;
  }

  .main-content {
    padding: 15px !important;
  }

  /* Configuración en fila */
  .main-controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .config-section {
    padding: 10px;
  }

  .individual-dice-list {
    max-height: 120px;
  }

  .dice-config-item {
    grid-template-columns: 40px 1fr 30px 30px;
    gap: 6px;
    padding: 6px;
  }

  .dice-number {
    min-width: 40px;
    font-size: 0.8rem;
  }

  .dice-face-select {
    padding: 6px;
    font-size: 0.8rem;
  }

  .btn-icon {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  /* Resultados más prominentes */
  .total-display {
    padding: 10px;
    margin: 15px 0;
  }

  .total-number {
    font-size: 4rem !important;
    text-shadow: 0 0 30px rgba(255, 107, 53, 0.9);
  }

  /* Dados más grandes y en menos filas */
  .dice {
    width: 65px;
    height: 65px;
    font-size: 1.7rem;
  }

  .dice-container {
    gap: 12px;
    margin: 15px 0;
  }

  /* Ocultar elementos menos importantes en horizontal */
  .info-card,
  .stats-panel,
  .history-panel:not(.force-show) {
    display: none !important;
  }

  /* Botones de control más grandes */
  .btn-roll {
    padding: 10px 20px;
    font-size: 1rem;
    flex: 1;
    min-width: 120px;
  }

  .roll-controls {
    gap: 8px;
    margin-bottom: 15px;
  }

  /* Información de rollos más compacta */
  .roll-info {
    padding: 8px;
    font-size: 0.8rem;
  }

  .info-item {
    flex: 1;
    justify-content: center;
    padding: 5px;
  }

  footer {
    padding: 10px !important;
    font-size: 0.75rem;
  }

  .preset-buttons {
    flex-direction: column;
  }

  .preset-btn {
    min-width: auto;
  }
}

/* Modo Vertical (Portrait) */
@media (orientation: portrait) {
  .floating-home-btn {
    display: none !important;
  }

  .dice {
    width: 80px;
    height: 80px;
    font-size: 2rem;
  }

  .total-number {
    font-size: 4rem;
  }

  .dice-config-item {
    grid-template-columns: 50px 1fr 36px 36px;
  }

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

/* Pantallas muy pequeñas (smartphones antiguos) */
@media (max-width: 320px) {
  .dice {
    width: 55px;
    height: 55px;
    font-size: 1.5rem;
  }

  .total-number {
    font-size: 3rem;
  }

  .btn-roll {
    padding: 10px 15px;
    font-size: 1rem;
  }

  .dice-config-item {
    grid-template-columns: 45px 1fr;
    gap: 8px;
  }

  .btn-icon {
    display: none;
  }

  .preset-buttons {
    grid-template-columns: 1fr;
  }
}

/* Tablets y pantallas más grandes */
@media (min-width: 768px) {
  .dice {
    width: 85px;
    height: 85px;
    font-size: 2.2rem;
  }

  .total-number {
    font-size: 5rem;
  }

  .btn-roll {
    padding: 15px 30px;
    font-size: 1.2rem;
  }
}

/* Animaciones específicas para móviles */
@media (hover: none) and (pointer: coarse) {
  .dice:active {
    transform: scale(0.95);
  }

  .roll-history-item:active {
    transform: scale(0.98);
  }

  .btn:active {
    transform: scale(0.98);
  }
}

/* Responsive para móviles */
@media (max-width: 768px) {
  .container {
    margin: 0;
  }
}

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
