/* ====================
   Home Page Inline Components
   Extraído de index.html - 9 Dic 2025
   ==================== */
    /* Twemoji: Asegura que los emojis de bandera se vean bien */
    img.emoji {
      height: 1em;
      width: 1em;
      margin: 0 .05em 0 .1em;
      vertical-align: -0.1em;
    }

    /* Custom Select Dropdown para banderas */
    .custom-select-wrapper {
      position: relative;
      display: inline-block;
      min-width: 180px;
    }

    .custom-select-trigger {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.5rem 1rem;
      background: white;
      border: 1px solid #ddd;
      border-radius: 8px;
      cursor: pointer;
      font-size: 0.9rem;
      color: #333;
      transition: all 0.2s;
    }

    .custom-select-trigger:hover {
      border-color: #3B5BA1;
    }

    .custom-select-trigger .arrow {
      font-size: 0.7rem;
      margin-left: 0.5rem;
      color: #666;
      transition: transform 0.2s;
    }

    .custom-select-wrapper.open .arrow {
      transform: rotate(180deg);
    }

    .custom-options {
      display: none;
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      background: white;
      border: 1px solid #ddd;
      border-radius: 8px;
      margin-top: 4px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      z-index: 1000;
      max-height: 250px;
      overflow-y: auto;
    }

    .custom-select-wrapper.open .custom-options {
      display: block;
    }

    .custom-option {
      padding: 0.6rem 1rem;
      cursor: pointer;
      color: #333;
      transition: background 0.2s;
    }

    .custom-option:hover {
      background: #f0f4ff;
    }

    .custom-option.selected {
      background: #e8efff;
      font-weight: 600;
    }

    .custom-option:first-child {
      border-radius: 8px 8px 0 0;
    }

    .custom-option:last-child {
      border-radius: 0 0 8px 8px;
    }

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

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: #f8f9fa;
      color: #333;
      line-height: 1.6;
      overflow-x: hidden;
      width: 100%;
      max-width: 100vw;
    }

    .container {
      max-width: 1200px;
      margin: 0 auto;
      padding: 0 1rem;
      width: 100%;
      box-sizing: border-box;
    }

    .header {
      background: linear-gradient(90deg, #1F2548 0%, #3B5BA1 100%);
      color: white;
      padding: 1rem 0;
    }

    .content {
      padding: 2rem 0;
    }

    .loading {
      text-align: center;
      padding: 3rem;
    }

    .spinner {
      width: 40px;
      height: 40px;
      border: 4px solid #f3f3f3;
      border-top: 4px solid #1F2548;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin: 0 auto 1rem;
    }

    @keyframes spin {
      0% {
        transform: rotate(0deg);
      }

      100% {
        transform: rotate(360deg);
      }
    }

    .btn {
      display: inline-block;
      padding: 0.75rem 1.5rem;
      background: #1F2548;
      color: white;
      text-decoration: none;
      border-radius: 6px;
      margin: 0.5rem;
      transition: all 0.3s ease;
      border: none;
      cursor: pointer;
      font-size: 0.9rem;
    }

    .btn:hover {
      background: #3B5BA1;
      transform: translateY(-1px);
    }

    .btn-small {
      padding: 0.5rem 1rem;
      font-size: 0.8rem;
    }

    .stats {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 1.5rem;
      margin: 2rem 0;
    }

    .stat {
      background: white;
      padding: 1.5rem;
      border-radius: 12px;
      text-align: center;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      transition: transform 0.3s ease;
    }

    .stat:hover {
      transform: translateY(-2px);
    }

    .stat-number {
      font-size: 2rem;
      font-weight: bold;
      color: #1F2548;
      margin-bottom: 0.5rem;
    }

    .stat-label {
      color: #6c757d;
      font-weight: 500;
    }

    .error {
      background: #f8d7da;
      color: #721c24;
      padding: 1rem;
      border-radius: 6px;
      margin: 1rem 0;
      border-left: 4px solid #dc3545;
    }

    .success {
      background: #d4edda;
      color: #155724;
      padding: 1rem;
      border-radius: 6px;
      margin: 1rem 0;
      border-left: 4px solid #28a745;
    }

    .card {
      background: white;
      border-radius: 12px;
      padding: 1.5rem;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      margin: 1rem 0;
    }

    .nav {
      display: flex;
      gap: 1rem;
      align-items: center;
      justify-content: space-between;
    }

    .nav-links {
      display: flex;
      gap: 0.5rem;
      align-items: center;
    }

    .nav a {
      color: white;
      text-decoration: none;
      padding: 0.625rem 1.25rem;
      border-radius: 6px;
      font-weight: 500;
      transition: all 0.3s ease;
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
    }

    .nav a:hover {
      background: rgba(255, 255, 255, 0.15);
      transform: translateY(-1px);
    }

    .nav a.nav-rankings {
      background: linear-gradient(135deg, #e63946 0%, #d62828 100%);
      box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
    }

    .nav a.nav-rankings:hover {
      background: linear-gradient(135deg, #d62828 0%, #c21d1d 100%);
      box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
    }

    .logo {
      font-size: 1.5rem;
      font-weight: bold;
    }

    h1 {
      font-size: 2.5rem;
      margin-bottom: 1rem;
    }

    h2 {
      font-size: 2rem;
      margin-bottom: 1rem;
      color: #1F2548;
    }

    h3 {
      font-size: 1.5rem;
      margin-bottom: 0.5rem;
    }

    .grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
      gap: 1.5rem;
    }

    .text-center {
      text-align: center;
    }

    input,
    select {
      padding: 0.5rem;
      margin: 0.25rem;
      border: 1px solid #ddd;
      border-radius: 4px;
      width: 250px;
    }

    pre {
      background: #f8f9fa;
      padding: 1rem;
      border-radius: 4px;
      margin-top: 1rem;
      overflow-x: auto;
    }

    /* Estilos específicos del mapa */
    .map-container {
      background: white;
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      margin: 2rem 0;
    }

    .map-header {
      background: linear-gradient(90deg, #1F2548 0%, #3B5BA1 100%);
      color: white;
      padding: 1rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .map-filters {
      display: flex;
      gap: 1rem;
      align-items: center;
    }

    .map-filters select {
      background: white;
      color: #333;
      border: none;
      padding: 0.5rem;
      border-radius: 4px;
      width: auto;
    }

    #eventos-map {
      height: 500px;
      width: 100%;
    }

    /* Estilos para las tarjetas de eventos */
    .eventos-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
      gap: 1.5rem;
      margin-top: 2rem;
    }

    /* Mobile: Horizontal swipeable slider for event cards */
    @media (max-width: 768px) {
      .eventos-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        gap: 1rem;
        padding: 0 1rem 1rem;
        margin: 0 -0.5rem;
        scrollbar-width: none;
      }
      
      .eventos-grid::-webkit-scrollbar {
        display: none;
      }
      
      .eventos-grid .evento-card {
        scroll-snap-align: center;
        flex: 0 0 85%;
        min-width: 280px;
        max-width: 320px;
      }
    }

    .evento-card {
      background: white;
      border-radius: 12px;
      padding: 1.5rem;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;
      border-left: 4px solid #1F2548;
      cursor: pointer;
      position: relative;
    }

    .evento-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .evento-card.catan {
      border-left-color: #8F1E21;
    }

    .evento-card.carcassonne {
      border-left-color: #1F2548;
    }

    .evento-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 1rem;
    }

    .tienda-name {
      font-size: 1.2rem;
      font-weight: bold;
      color: #1F2548;
      margin-bottom: 0.5rem;
    }

    .game-badge {
      padding: 0.25rem 0.75rem;
      border-radius: 20px;
      font-size: 0.8rem;
      font-weight: bold;
      color: white;
    }

    .game-badge.catan {
      background: linear-gradient(45deg, #8F1E21, #DC641E);
    }

    .game-badge.carcassonne {
      background: linear-gradient(45deg, #1F2548, #3B5BA1);
    }

    .evento-type {
      background: #e9ecef;
      color: #495057;
      padding: 0.25rem 0.75rem;
      border-radius: 20px;
      font-size: 0.8rem;
      font-weight: 500;
    }

    /* Badges adicionales (Grupo 1) */
    .badges-container {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    .badge-adicional {
      display: inline-block;
      padding: 0.25rem 0.6rem;
      border-radius: 12px;
      font-size: 0.75rem;
      font-weight: 600;
      white-space: nowrap;
    }

    .badge-competitivo {
      background: linear-gradient(135deg, #dc3545, #c82333);
      color: white;
    }

    .badge-casual {
      background: linear-gradient(135deg, #17a2b8, #138496);
      color: white;
    }

    .badge-edad {
      background: linear-gradient(135deg, #ffc107, #e0a800);
      color: #333;
    }

    .badge-nivel {
      background: linear-gradient(135deg, #6f42c1, #5a32a3);
      color: white;
    }

    .badge-demo {
      background: linear-gradient(135deg, #28a745, #218838);
      color: white;
    }

    .badge-promo {
      background: linear-gradient(135deg, #fd7e14, #e8590c);
      color: white;
    }

    .evento-info p {
      margin: 0.5rem 0;
    }

    .register-btn {
      display: inline-block;
      padding: 0.75rem 1.5rem;
      background: #28a745;
      color: white;
      text-decoration: none;
      border-radius: 6px;
      margin-top: 1rem;
      transition: all 0.3s ease;
    }

    .register-btn:hover {
      background: #218838;
      transform: translateY(-1px);
    }

    /* Indicador de cupos */
    .cupos-indicator {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin: 0.75rem 0;
      padding: 0.5rem;
      background: #f8f9fa;
      border-radius: 6px;
      font-size: 0.9rem;
    }

    .cupos-bar-container {
      flex: 1;
      height: 8px;
      background: #e9ecef;
      border-radius: 4px;
      overflow: hidden;
    }

    .cupos-bar {
      height: 100%;
      background: linear-gradient(90deg, #28a745, #20c997);
      border-radius: 4px;
      transition: width 0.3s ease;
    }

    .cupos-bar.warning {
      background: linear-gradient(90deg, #ffc107, #fd7e14);
    }

    .cupos-bar.danger {
      background: linear-gradient(90deg, #dc3545, #c82333);
    }

    .cupos-text {
      font-weight: 600;
      color: #495057;
      white-space: nowrap;
    }

    .cupos-badge {
      padding: 0.25rem 0.5rem;
      border-radius: 12px;
      font-size: 0.75rem;
      font-weight: 600;
    }

    .cupos-badge.disponible {
      background: #d4edda;
      color: #155724;
    }

    .cupos-badge.pocos {
      background: #fff3cd;
      color: #856404;
    }

    .cupos-badge.lleno {
      background: #f8d7da;
      color: #721c24;
    }

    .cupos-badge.ilimitado {
      background: #d1ecf1;
      color: #0c5460;
    }

    /* Estilos del Modal */
    .modal {
      display: none;
      position: fixed;
      z-index: 1000;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      overflow: auto;
      background-color: rgba(0, 0, 0, 0.6);
      animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
      }

      to {
        opacity: 1;
      }
    }

    .modal-content {
      background-color: white;
      margin: 2% auto;
      padding: 2rem;
      padding-bottom: 2.5rem; /* Extra padding para asegurar que todo sea visible */
      border-radius: 12px;
      width: 90%;
      max-width: 600px;
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
      animation: slideIn 0.3s ease;
      max-height: 90vh;
      overflow-y: auto;
      /* Asegurar scroll visible y suave */
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
      scrollbar-color: #FF007A #f1f1f1;
    }
    
    /* Scrollbar para Webkit (Chrome, Safari, Edge) */
    .modal-content::-webkit-scrollbar {
      width: 8px;
    }
    
    .modal-content::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 10px;
    }
    
    .modal-content::-webkit-scrollbar-thumb {
      background: #FF007A;
      border-radius: 10px;
    }
    
    .modal-content::-webkit-scrollbar-thumb:hover {
      background: #cc0061;
    }

    @keyframes slideIn {
      from {
        transform: translateY(-50px);
        opacity: 0;
      }

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

    .close {
      color: #aaa;
      float: right;
      font-size: 28px;
      font-weight: bold;
      cursor: pointer;
      line-height: 1;
    }

    .close:hover,
    .close:focus {
      color: #000;
    }

    .form-group {
      margin-bottom: 1rem;
    }

    .form-group label {
      display: block;
      margin-bottom: 0.5rem;
      font-weight: 600;
      color: #333;
    }

    /* Responsive */
    @media (max-width: 768px) {
      .container {
        padding: 0 0.75rem;
      }

      .map-header {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
      }

      .map-header h3 {
        font-size: 1.2rem;
        text-align: center;
      }

      .map-filters {
        flex-wrap: wrap;
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
      }

      .map-filters select,
      .custom-select-wrapper {
        width: 100%;
        min-width: 100%;
      }

      .map-filters .btn {
        width: 100%;
      }

      #eventos-map {
        height: 400px;
      }

      .nav {
        flex-direction: column;
        gap: 0.75rem;
      }

      .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
      }

      .nav-links a {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
      }

      .logo {
        text-align: center;
      }

      .eventos-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
      }

      h1 {
        font-size: 1.75rem;
      }

      h2 {
        font-size: 1.5rem;
      }

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

      .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 1.5rem;
      }

      .hero img {
        width: 100%;
        height: auto;
        object-fit: cover;
      }
    }

    @media (max-width: 480px) {
      .container {
        padding: 0 0.5rem;
      }

      .nav-links a {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
      }

      .nav-links a span {
        display: none;
      }

      h1 {
        font-size: 1.5rem;
      }

      h2 {
        font-size: 1.3rem;
      }

      h3 {
        font-size: 1.1rem;
      }

      .map-header h3 {
        font-size: 1.1rem;
      }

      #eventos-map {
        height: 350px;
      }

      .stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
      }

      .modal-content {
        width: 98%;
        margin: 2% auto;
        padding: 1rem;
      }

      .form-group {
        margin-bottom: 0.75rem;
      }

      input, select, textarea {
        font-size: 16px; /* Evita zoom en iOS */
      }

      .footer-title {
        font-size: 1rem !important;
      }

      .footer-text {
        font-size: 0.85rem !important;
      }

      .footer-copyright {
        font-size: 0.75rem !important;
      }

      .store-cta-section h2 {
        font-size: 1.3rem !important;
        padding: 0 0.5rem;
      }

      .store-cta-section p {
        font-size: 0.9rem !important;
        padding: 0 0.5rem;
      }

      .events-header h2 {
        font-size: 1.3rem !important;
        padding: 0 0.5rem;
      }

      .events-header p {
        font-size: 0.9rem !important;
        padding: 0 0.5rem;
      }
    }
