/**
 * IMPORTANTE: Los valores de data-modo deben coincidir con las constantes PHP
 * Agenda_icomem::MODO_CALENDARIO = 'calendario'
 * Agenda_icomem::MODO_LISTADO = 'listado'
 *
 * Si cambias las constantes PHP, actualiza también estos selectores CSS.
 */

header.header {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 750;
    letter-spacing: -1px;

    svg {
      color: var(--tertiary-color) !important;
    }
  }

  .btn-toggle-modo {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin: 0;
    outline: none;
    transition: all .2s;
    line-height: 0;
    /* aspect-ratio: 1; */
    border-radius: 8px;

    &:hover {
      background-color: hsl(from var(--primary-color) h s calc(l + 10));
      box-shadow: var(--material-shadow);
    }

    &:active {
      transform: scale(.8);
    }

    .button-inner {
      display: flex;
      align-items: center;
      gap: 8px;

      .texto-modo {
        font-size: 12px;
        font-weight: 500;

        @media(max-width: 500px) {
          display: none;
        }
      }

      .material-icons {
        font-size: 20px;
        color: currentColor;
      }
    }

  }
}

main.agenda-icomem-main {
  margin-top: 24px;
  margin-bottom: 48px;
  display: grid;
  gap: 16px;
  align-items: start;

  @media(max-width: 1200px) {
    grid-template-columns: 1fr !important;

    aside.aside {
      grid-row: 1;
    }
  }

  &[data-modo="calendario"] {
    grid-template-columns: 1fr;

    .list-section,
    .filter-section {
      display: none;
    }

    aside.aside {
      grid-template-columns: 1fr !important;
    }
  }

  &[data-modo="listado"] {
    grid-template-columns: 1fr 350px;

    .contenedor-filtro-agendas {
      display: none !important;
    }
  }

  section {
    width: 100%;
    margin: 0 !important;
  }
}

section.list-section {

  .listado-eventos {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  a.item {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 16px;
    background-color: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: var(--material-shadow);
    color: var(--color-black);

    /* &:has(.item-info .evento-header .sesion) {
      border: dashed 2px hsl(0, 0%, 80%)
    } */

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

    &:hover {
      text-decoration: none;

      img.imagen-evento {
        scale: 1.1;
        rotate: 2deg;
      }

      h3 {
        text-decoration: underline;
      }
    }

    .item-info {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .evento-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 4px;

      .fecha {
        display: flex;
        align-items: center;
        gap: 16px;
        font-size: 12px;
        color: hsl(0, 0%, 70%);
        font-weight: 500;
      }

      .tags {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 4px;

        .tag-tipo {
          border-radius: 99px;
          font-size: 11px;
          padding: 4px 10px;
          font-weight: 500;
          display: inline-block;
          background-color: white;
          color: hsl(from var(--_color, gray) h s min(calc(l + 30), 50));
          border: solid 1px hsl(from var(--_color, gray) h s min(calc(l + 20), 70));
        }

        .tag-sesion {
          border-radius: 99px;
          font-size: 11px;
          padding: 4px 10px;
          font-weight: 500;
          display: inline-block;
          background-color: white;
          color: hsl(0, 0%, 70%);
          border: solid 1px hsl(0, 0%, 70%);
        }
      }

    }

    h3 {
      margin: 0;
      font-size: clamp(13px, 1.5vw, 16px);
      font-weight: 700;
      /** Para mostrar solo 2 lineas máximo **/
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .resumen,
    .resumen>.contenido_tinymce {
      font-size: clamp(12px, 1.5vw, 1.25rem);
      line-height: 1.6;
    }

    .imagen-evento-contenedor {
      width: 100%;
      height: auto;
      aspect-ratio: 16/10;
      overflow: hidden;
      border-radius: 5px;

      img.imagen-evento {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: all .5s ease-in-out;
      }
    }

    .etiquetas {
      margin-top: 12px;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 4px;

      .tag {
        border-radius: 99px;
        font-size: 11px;
        padding: 4px 10px;
        font-weight: 500;
        display: inline-block;

        &.plazas_disponibles {
          background-color: hsl(115, 39%, 60%);
          color: white;
        }

        &.inscripcion_gratuita {
          background-color: #F3AE21;
          color: white;
        }

        &.finalizado {
          background-color: hsl(0, 0%, 10%);
          color: white;
        }

        &.cerrado {
          background-color: hsl(357, 87%, 40%);
          color: white;
        }
      }
    }
  }
}

aside.aside {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 16px;

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

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

section.filter-section {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--material-shadow);

  h3 {
    margin: 0 0 24px 0;
    font-size: 1.8rem;
    font-weight: 400;
    text-transform: uppercase;
    font-family: var(--secondary-font);
  }

  .form-group {
    margin-bottom: 8px;

    .checkbox {
      padding-top: 0;
    }
  }

  button.btn-buscar {
    margin-top: 16px;
  }
}

section.agenda-icomem-section {
  max-width: 900px;
  margin: 0 auto;

  /**  Filtro de categorías - agendas **/
  .contenedor-filtro-agendas {
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    background-color: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: var(--material-shadow);

    container-type: inline-size;
    container-name: filtro-agenda;

    .texto-filtro {
      font-weight: bold;
      margin-right: 10px;
      color: #333;

      @container filtro-agenda (max-width: 600px) {
        display: none;
      }
    }

    .filtro-agenda {
      padding: 4px 12px;
      border: 2px solid transparent;
      border-radius: 20px;
      background: white;
      cursor: pointer;
      transition: all 0.2s ease;
      font-weight: 600;
      font-size: clamp(11px, 1.5vw, 13px);
      outline: none;

      opacity: .35;
      background-color: hsl(from var(--_bg-color) h s calc(l + 8));
      border-color: hsl(from var(--_bg-color) h s calc(l - 10));
      color: var(--_text-color);


      &:hover {
        box-shadow: var(--material-shadow);
        background-color: hsl(from var(--_bg-color) h s calc(l + 10));
        border-color: hsl(from var(--_bg-color) h s calc(l - 12));
      }

      &[data-categoria="AFAM"] {
        --_bg-color: hsl(357, 87%, 80%);
        --_text-color: hsl(357, 87%, 40%);
      }

      &[data-categoria="Cultural"] {
        --_bg-color: hsl(126, 36%, 75%);
        --_text-color: hsl(126, 36%, 29%);
      }

      &[data-categoria="Institucional"] {
        --_bg-color: hsl(from var(--primary-color) h s calc(l + 50));
        --_text-color: hsl(from var(--primary-color) h s calc(l + 20));
        ;
      }

      &[data-categoria="Jubilados"] {
        --_bg-color: hsl(from var(--tertiary-color) h s calc(l + 30));
        --_text-color: hsl(from var(--tertiary-color) h s calc(l - 20));
      }

      &.activa {
        opacity: 1;
      }

    }
  }
}

.bs-callout-info {
  margin-top: 0;
  border-radius: 8px;
}