/**
 * Stili per lo shortcode [cdc_eventi_passati]
 * 
 * @package Tribe_Gestione_EM
 * @version 0.2.0
 */

/* ==========================================================================
   Wrapper principale
   ========================================================================== */
.cdc-eventi-passati-wrapper {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* ==========================================================================
   Card Statistiche
   ========================================================================== */
.cdc-stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.cdc-stat-card {
  background: linear-gradient(135deg, #950c45 0%, #6a0832 100%);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  color: #fff;
}

.cdc-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 12px rgba(149, 12, 69, 0.3);
}

.cdc-stat-icon {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cdc-stat-icon .dashicons {
  font-size: 32px;
  width: 32px;
  height: 32px;
  color: #fff;
}

.cdc-stat-content {
  flex: 1;
}

.cdc-stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.cdc-stat-label {
  font-size: 0.875rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Export
   ========================================================================== */
.cdc-export-controls {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 1rem;
}

.cdc-export-button {
  background: linear-gradient(135deg, #950c45 0%, #6a0832 100%);
  border: none;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.cdc-export-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(149, 12, 69, 0.25);
}

/* ==========================================================================
   Tabella Eventi
   ========================================================================== */
.cdc-eventi-table-wrapper {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 2rem;
}

.cdc-eventi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.cdc-eventi-table thead {
  background: linear-gradient(135deg, #950c45 0%, #6a0832 100%);
  color: #fff;
}

.cdc-eventi-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.cdc-eventi-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.cdc-eventi-table tbody tr:hover {
  background-color: #fef7fa;
}

.cdc-eventi-table tbody tr:last-child {
  border-bottom: none;
}

.cdc-eventi-table td {
  padding: 1rem;
  vertical-align: middle;
}

/* Colonna Data */
.cdc-col-data {
  width: 120px;
}

.cdc-date {
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
}

/* Colonna Evento */
.cdc-col-evento {
  min-width: 250px;
}

.cdc-event-link {
  color: #950c45;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.cdc-event-link:hover {
  color: #6a0832;
  text-decoration: underline;
}

.cdc-event-link::after {
  content: "→";
  font-size: 1.1em;
  transition: transform 0.2s ease;
}

.cdc-event-link:hover::after {
  transform: translateX(4px);
}

/* Colonna Categoria */
.cdc-col-categoria {
  width: 180px;
}

.cdc-categoria {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: #f5f5f5;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #555;
}

/* Colonna Produttori */
.cdc-col-produttori {
  width: 200px;
}

.cdc-produttori-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cdc-producer-tag {
  display: inline-block;
  padding: 4px 10px;
  background: linear-gradient(135deg, #950c45 0%, #6a0832 100%);
  color: #fff;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.cdc-no-producer {
  color: #999;
  font-style: italic;
}

/* Colonna Partecipanti */
.cdc-col-partecipanti {
  width: 120px;
  text-align: center;
}

.cdc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.cdc-badge .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.cdc-badge-success {
  background: #d4edda;
  color: #155724;
}

.cdc-badge-warning {
  background: #fff3cd;
  color: #856404;
}

.cdc-badge-default {
  background: #e2e3e5;
  color: #383d41;
}

/* ==========================================================================
   Paginazione
   ========================================================================== */
.cdc-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.cdc-page-link,
.cdc-page-num {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-decoration: none;
  color: #333;
  background: #fff;
  font-weight: 500;
  transition: all 0.2s ease;
}

.cdc-page-link:hover:not(.disabled),
.cdc-page-num:hover {
  background: #950c45;
  color: #fff;
  border-color: #950c45;
}

.cdc-page-num.active {
  background: #950c45;
  color: #fff;
  border-color: #950c45;
  cursor: default;
}

.cdc-page-link.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.cdc-page-numbers {
  display: flex;
  gap: 0.5rem;
}

.cdc-page-dots {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem;
  color: #999;
}

/* ==========================================================================
   Stati Vuoti ed Errori
   ========================================================================== */
.cdc-eventi-vuoto,
.cdc-eventi-error {
  background: #f8f9fa;
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  color: #666;
}

.cdc-eventi-vuoto p,
.cdc-eventi-error p {
  font-size: 1.1rem;
  margin: 0;
}

.cdc-eventi-error {
  background: #fff3cd;
  border-color: #ffc107;
  color: #856404;
}

/* ==========================================================================
   Tabella Aggregata (Repliche)
   ========================================================================== */
.cdc-eventi-aggregati-table thead {
  background: linear-gradient(135deg, #6a0832 0%, #4a0520 100%);
}

/* Colonna Repliche */
.cdc-col-repliche {
  min-width: 180px;
}

.cdc-repliche-dates {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.cdc-date-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, #950c45 0%, #6a0832 100%);
  color: #fff;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: help;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(149, 12, 69, 0.2);
}

.cdc-date-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(149, 12, 69, 0.3);
}

.cdc-date-badge:first-child {
  font-weight: 700;
  border: 2px solid #950c45;
  background: #fff;
  color: #950c45;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media screen and (max-width: 992px) {
  .cdc-stats-cards {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
  }

  .cdc-stat-card {
    padding: 1.25rem;
  }

  .cdc-stat-icon {
    width: 50px;
    height: 50px;
  }

  .cdc-stat-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
  }

  .cdc-stat-value {
    font-size: 1.75rem;
  }

  .cdc-eventi-table {
    font-size: 0.9rem;
  }

  .cdc-eventi-table th,
  .cdc-eventi-table td {
    padding: 0.75rem;
  }
}

@media screen and (max-width: 768px) {
  /* Layout cards */
  .cdc-stats-cards {
    grid-template-columns: 1fr;
  }

  /* Tabella responsive: trasforma in card */
  .cdc-eventi-table-wrapper {
    border-radius: 0;
  }

  .cdc-eventi-table thead {
    display: none;
  }

  .cdc-eventi-table,
  .cdc-eventi-table tbody,
  .cdc-eventi-table tr,
  .cdc-eventi-table td {
    display: block;
    width: 100%;
  }

  .cdc-eventi-table tbody tr {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .cdc-eventi-table tbody tr:hover {
    background: #fef7fa;
  }

  .cdc-eventi-table td {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f5f5f5;
    text-align: left !important;
  }

  .cdc-eventi-table td:last-child {
    border-bottom: none;
  }

  .cdc-eventi-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    color: #950c45;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Colonne specifiche in mobile */
  .cdc-col-data,
  .cdc-col-evento,
  .cdc-col-categoria,
  .cdc-col-repliche,
  .cdc-col-partecipanti {
    width: 100%;
    min-width: auto;
  }

  .cdc-repliche-dates {
    margin-top: 0.5rem;
  }

  .cdc-date-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }

  .cdc-badge {
    display: inline-flex;
  }

  /* Paginazione mobile */
  .cdc-pagination {
    gap: 0.35rem;
  }

  .cdc-page-link,
  .cdc-page-num {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
  }

  .cdc-page-numbers .cdc-page-num:not(.active) {
    display: none;
  }

  .cdc-page-numbers .cdc-page-num.active {
    display: inline-flex;
  }

  .cdc-page-dots {
    display: none;
  }
}

@media screen and (max-width: 480px) {
  .cdc-eventi-passati-wrapper {
    padding: 0 0.5rem;
  }

  .cdc-stat-value {
    font-size: 1.5rem;
  }

  .cdc-stat-label {
    font-size: 0.75rem;
  }

  .cdc-page-link,
  .cdc-page-num {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
  }
}
