/**
 * Elementor Widgets Base Styles
 * 
 * @package EligeMenu_Integration
 * @since 2.0.0
 */

/* General Widget Styles */
.em-daily-menus-list,
.em-menu-minimal,
.em-menu-cards,
.em-menu-elegante,
.em-menu-chalkboard {
    width: 100%;
}

/* Grid Layout */
.em-grid {
    display: grid;
    gap: 20px;
}

/* List Layout */
.em-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Daily Menu Item */
.em-daily-menu-item {
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.em-restaurant-name {
    margin: 0 0 10px;
    font-size: 1.25rem;
    font-weight: 600;
}

.em-menu-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.em-date {
    color: #666;
    font-size: 0.875rem;
}

.em-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: #10b981;
}

/* Dishes List */
.em-dishes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.em-dishes-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.em-dishes-list li:last-child {
    border-bottom: none;
}

/* Timeline Layout */
.em-daily-menus-timeline {
    position: relative;
    padding: 20px 0;
}

.em-daily-menus-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
    transform: translateX(-50%);
}

.em-timeline-item {
    position: relative;
    margin-bottom: 40px;
}

.em-timeline-marker {
    position: absolute;
    left: 50%;
    top: 0;
    width: 16px;
    height: 16px;
    background: #10b981;
    border: 3px solid #ffffff;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 0 4px #e5e7eb;
}

.em-timeline-content {
    width: 45%;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.em-timeline-left .em-timeline-content {
    margin-right: auto;
}

.em-timeline-right .em-timeline-content {
    margin-left: auto;
}

/* Filters */
.em-filters {
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 30px;
}

.em-filters-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.em-filters-vertical {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.em-filter-search {
    flex: 1;
    min-width: 200px;
}

.em-search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.em-allergen-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.em-chip {
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.em-chip[aria-pressed="true"] {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

.em-chip:hover {
    background: #f3f4f6;
}

/* Schedule Banner */
.em-schedule-banner {
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

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

.em-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.em-status-icon {
    display: flex;
    align-items: center;
}

.em-status-text {
    font-weight: 500;
    font-size: 1rem;
}

.em-schedule-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: inherit;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.em-schedule-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.em-toggle-icon {
    transition: transform 0.3s ease;
}

.em-schedule-content {
    padding: 1.5rem;
    background: #ffffff;
}

.em-schedule-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.em-schedule-table th {
    background: #f9fafb;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    font-size: 0.875rem;
    color: #374151;
}

.em-schedule-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #1f2937;
}

.em-schedule-table tr:last-child td {
    border-bottom: none;
}

.em-schedule-table tr.em-current-day {
    background-color: #fef3c7;
}

.em-schedule-table tr.em-current-day td {
    font-weight: 600;
}

.em-day-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.em-current-badge {
    display: inline-block;
    background: #f59e0b;
    color: #ffffff;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.em-schedule-hours {
    line-height: 1.6;
}

.em-schedule-hours br {
    content: "";
    display: block;
    margin: 0.25rem 0;
}

.em-closed {
    color: #9ca3af;
    font-weight: 500;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .em-banner-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .em-schedule-toggle {
        width: 100%;
        justify-content: space-between;
    }
    
    .em-schedule-content {
        padding: 1rem;
    }
    
    .em-schedule-table {
        font-size: 0.8rem;
    }
    
    .em-schedule-table th,
    .em-schedule-table td {
        padding: 0.5rem;
    }
}

.em-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #10b981;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.em-btn:hover {
    background: #059669;
}

.em-btn-light {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.em-btn-light:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Single Menu Group Widget */
.em-single-menu-group {
    width: 100%;
}

.em-group-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

.em-group-description {
    color: #6b7280;
    font-size: 1rem;
    margin: 0 0 2rem;
}

.em-dishes-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Specialty Badge */
.em-specialty-badge {
    display: inline-block;
    background: #f59e0b;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
    vertical-align: middle;
}

/* Layout: Grid */
.em-layout-grid .em-dishes-container,
.em-layout-cards .em-dishes-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.em-layout-grid .em-dishes-container.em-columns-1,
.em-layout-cards .em-dishes-container.em-columns-1 {
    grid-template-columns: 1fr;
}

.em-layout-grid .em-dishes-container.em-columns-3,
.em-layout-cards .em-dishes-container.em-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.em-layout-grid .em-dishes-container.em-columns-4,
.em-layout-cards .em-dishes-container.em-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Dish Item */
.em-dish-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: all 0.3s ease;
}

.em-layout-cards .em-dish-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.em-layout-cards .em-dish-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Image Positions */
.em-image-left .em-dish-item,
.em-image-right .em-dish-item {
    flex-direction: row;
    align-items: flex-start;
}

.em-image-right .em-dish-item {
    flex-direction: row-reverse;
}

.em-dish-image {
    width: 100%;
    overflow: hidden;
}

.em-image-left .em-dish-image,
.em-image-right .em-dish-image {
    width: 200px;
    flex-shrink: 0;
}

.em-dish-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Image Aspect Ratios */
.em-dish-image.em-aspect-16-9 {
    aspect-ratio: 16 / 9;
}

.em-dish-image.em-aspect-4-3 {
    aspect-ratio: 4 / 3;
}

.em-dish-image.em-aspect-1-1 {
    aspect-ratio: 1 / 1;
}

.em-dish-image.em-aspect-auto {
    aspect-ratio: auto;
}

/* Dish Content */
.em-dish-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.em-dish-image-wrapper {
    flex-shrink: 0;
}

.em-dish-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.em-dish-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.em-dish-counter {
    font-weight: 700;
    color: #9ca3af;
    font-size: 0.875rem;
}

.em-dish-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.em-dotted-line {
    flex: 1;
    border-bottom: 2px dotted #d1d5db;
    margin: 0 0.5rem;
    min-width: 20px;
    align-self: flex-end;
    margin-bottom: 0.25rem;
}

.em-dish-prices {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    flex-shrink: 0;
    white-space: nowrap;
}

.em-dish-price {
    font-weight: 600;
    font-size: 1rem;
    color: #10b981;
}

.em-dish-price-1 {
    color: #10b981;
}

.em-dish-price-2 {
    color: #6366f1;
}

.em-price-label {
    font-weight: 400;
    font-size: 0.875rem;
    color: #6b7280;
}

.em-dish-description {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
}

.em-dish-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.em-dish-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #f3f4f6;
    color: #374151;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.em-dish-allergens {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.em-allergen-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Responsive */
@media (max-width: 768px) {
    .em-daily-menus-timeline::before {
        left: 20px;
    }
    
    .em-timeline-marker {
        left: 20px;
    }
    
    .em-timeline-content {
        width: calc(100% - 60px);
        margin-left: 60px !important;
    }
    
    .em-filters-horizontal {
        flex-direction: column;
        align-items: stretch;
    }
    
    .em-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    /* Single Menu Group Responsive */
    .em-layout-grid .em-dishes-container,
    .em-layout-cards .em-dishes-container {
        grid-template-columns: 1fr;
    }
    
    .em-dish-item {
        flex-direction: column;
    }
    
    .em-image-left .em-dish-item,
    .em-image-right .em-dish-item {
        flex-direction: column;
    }
    
    .em-image-left .em-dish-image,
    .em-image-right .em-dish-image {
        width: 100%;
    }
    
    /* Hide dotted line on mobile */
    .em-dotted-line {
        display: none;
    }
    
    /* Stack header items on mobile */
    .em-dish-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .em-dish-prices {
        margin-left: 0;
    }
}

/* ==========================================
   Dish List Item Widget (v2.6.7)
   ========================================== */

/* Wrapper que contiene todos los items */
.em-dishlist-wrapper {
  width: 100%;
  max-width: 100%;
}

/* Item individual (con separación entre items) */
.em-dishlist-item {
  display: block;
  margin-bottom: 1.5rem;
}

/* Layout de 2 columnas: imagen | contenido (que incluye título, leader, precios en misma línea) */
.em-dish {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
  width: 100%;
}

/* Ocultar columna de imagen cuando show_image = no */
.em-dish--no-image {
  grid-template-columns: 1fr !important;
}

.em-dish--no-image .em-dish__image {
  display: none;
}

/* Columna 1: Imagen */
.em-dish__image {
  flex-shrink: 0;
  width: 80px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 0; /* Sin border-radius por defecto, se controla desde estilos */
}

/* Colapsar columna de imagen si está vacía (sin imagen) */
.em-dish__image:empty {
  width: 0;
  min-width: 0;
}

.em-dish__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Columna 2: Contenido (nombre, badge, leader, descripción, alérgenos) */
.em-dish__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Header: título + badge + leader + precios (todos en primera línea) */
.em-dish__header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.em-dish__title {
  margin: 0;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 1rem;
  flex: 0 1 auto;
  min-width: 0;
  white-space: normal;
  color: #000000;
  line-height: 1.3;
}

/* Badge especialidad (inline después del título, se mantiene en primera línea) */
.em-dish__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background-color: #ff6b35;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 3px;
  line-height: 1;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Dotted leader (línea de puntos - crece para llenar espacio, se mantiene en primera línea) */
.em-dish__leader {
  flex: 1 1 auto;
  min-width: 2rem;
  height: 2px;
  background-image: radial-gradient(
    circle,
    var(--leader-color, #cccccc) 2px,
    transparent 2px
  );
  background-size: 5px 1px;
  background-repeat: repeat-x;
  background-position: center;
}

/* Descripción */
.em-dish__desc {
  margin: 0;
  line-height: 1.5;
  color: #000000;
  font-size: 0.9rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Alérgenos */
.em-dish__allergens {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.em-dish__allergens .em-allergen-icon {
  width: 20px;
  height: 20px;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.em-dish__allergens .em-allergen-icon:hover {
  opacity: 0.7;
}

/* Precios dentro del header (alineados a la derecha, se mantienen en primera línea) */
.em-dish__prices {
  display: flex;
  gap: 0.25rem;
  white-space: nowrap;
  align-items: baseline;
  flex: 0 0 auto;
  line-height: 1.3;
}

.em-dish__price--p1,
.em-dish__price--p2 {
  font-weight: 600;
  color: #000000;
  font-size: inherit; /* Respeta el tamaño de Elementor */
}

.em-dish__price--sep {
  display: inline;
  font-weight: 400;
}

/* Divisor entre items */
.em-dishlist-item.em-has-divider::after {
  content: '';
  display: block;
  width: 100%;
  height: 1px;
  background-color: #e0e0e0;
  margin-top: 1.5rem;
}

/* Separador vertical único entre columnas */
.em-dishlist-wrapper--with-separator.em-dishlist-wrapper--columns {
  position: relative;
}

/* Separadores verticales únicos con pseudo-elementos */
.em-dishlist-wrapper--with-separator[data-columns="2"]::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--separator-width, 1px);
  background-color: var(--separator-color, #e0e0e0);
  border-left: var(--separator-width, 1px) var(--separator-style, solid) var(--separator-color, #e0e0e0);
  pointer-events: none;
}

.em-dishlist-wrapper--with-separator[data-columns="3"]::before,
.em-dishlist-wrapper--with-separator[data-columns="3"]::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--separator-width, 1px);
  background-color: var(--separator-color, #e0e0e0);
  border-left: var(--separator-width, 1px) var(--separator-style, solid) var(--separator-color, #e0e0e0);
  pointer-events: none;
}

.em-dishlist-wrapper--with-separator[data-columns="3"]::before {
  left: 33.333%;
  transform: translateX(-50%);
}

.em-dishlist-wrapper--with-separator[data-columns="3"]::after {
  left: 66.666%;
  transform: translateX(-50%);
}

.em-dishlist-wrapper--with-separator[data-columns="4"]::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 25%;
  transform: translateX(-50%);
  width: var(--separator-width, 1px);
  border-left: var(--separator-width, 1px) var(--separator-style, solid) var(--separator-color, #e0e0e0);
  pointer-events: none;
}

.em-dishlist-wrapper--with-separator[data-columns="4"]::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--separator-width, 1px);
  border-left: var(--separator-width, 1px) var(--separator-style, solid) var(--separator-color, #e0e0e0);
  pointer-events: none;
  box-shadow: calc(100% / 4) 0 0 0 var(--separator-color, #e0e0e0);
  border-right: var(--separator-width, 1px) var(--separator-style, solid) transparent;
}

/* Responsive: móvil */
@media (max-width: 768px) {
  .em-dish {
    grid-template-columns: auto 1fr;
    gap: 15px;
  }
  
  .em-dish__image {
    width: 60px;
  }
  
  .em-dish__header {
    flex-wrap: nowrap;         /* NO hacer wrap - mantener en una línea */
    align-items: flex-start;   /* Alinear al inicio (top) */
  }
  
  .em-dish__title {
    white-space: normal;       /* Permitir wrap del título */
    flex: 1;                   /* Ocupar espacio disponible */
    min-width: 0;              /* Permitir que se reduzca */
  }
  
  .em-dish__leader {
    display: none;
  }
  
  .em-dish__prices {
    margin-left: auto;         /* Mantener a la derecha */
    white-space: nowrap;       /* Evitar salto de línea */
    flex-shrink: 0;            /* No reducir tamaño */
    padding-left: 8px;         /* Espacio entre título y precio */
  }
  
  /* Ocultar separadores de columna en móvil cuando colapsa a 1 columna */
  .em-dishlist-wrapper--with-separator[data-columns]::before,
  .em-dishlist-wrapper--with-separator[data-columns]::after {
    display: none;
  }
}
