@import './variables.scss';

.execomm-section {
  padding-block: 8rem;
  padding-inline: 2.81rem;
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  min-height: 100vh;

  h1 {
    text-align: center;
    color: $primary;
    font-size: 3rem; 
    font-weight: 900;
    margin-bottom: 3rem;
  }

  .banner-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 4rem auto;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);

    img {
      width: 100%;
      height: auto; 
      display: block;
    }
  }

  .photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    
    .photo-card {
      cursor: pointer; // Show pointer to indicate clickable
      width: 100%;
      border-radius: 1rem;
      overflow: hidden;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
      transition: transform 0.3s ease;

      &:hover {
        transform: translateY(-5px);
      }

      img {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1; 
        object-fit: cover;
        display: block;
      }
    }
  }
}

/* Modal Styles */
.image-modal {
  display: none; 
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  align-items: center;
  justify-content: center;
  padding: 20px;

  .modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
  }

  .close-modal {
    position: absolute;
    top: 30px;
    right: 40px;
    color: #f1f1f1;
    font-size: 60px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
  }
}

/* Past Committees Accordion Styles */
.past-committees-wrapper {
  margin-top: 6rem;
  max-width: 900px;
  margin-inline: auto;

  h2 {
    text-align: center;
    color: $primary;
    font-size: 2.5rem;
    margin-bottom: 3rem;
  }

  .accordion-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .committee-accordion {
    background-color: $background-accent;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;

    &[open] {
      summary {
        border-bottom: 1px solid rgba(0,0,0,0.1);
        &::after {
          content: '−'; /* Minus sign when open */
        }
      }
    }

    summary {
      padding: 1.5rem 2rem;
      font-size: 1.25rem;
      font-weight: 700;
      color: $dark;
      cursor: pointer;
      list-style: none; /* Hides the default browser arrow */
      display: flex;
      justify-content: space-between;
      align-items: center;
      transition: background-color 0.2s ease;

      /* Custom plus sign */
      &::after {
        content: '+';
        font-size: 1.5rem;
        color: $primary;
        font-weight: 400;
      }

      &:hover {
        background-color: rgba(0, 0, 0, 0.02);
      }

      /* Safari fix to hide the default arrow */
      &::-webkit-details-marker {
        display: none;
      }
    }

    .accordion-content {
      padding: 1.5rem 2rem;
      background-color: #fff;

      ul {
        list-style: none;
        padding: 0;
        margin: 0;

        li {
          display: flex;
          justify-content: space-between;
          padding-block: 0.75rem;
          border-bottom: 1px dashed rgba(0,0,0,0.1);

          &:last-child {
            border-bottom: none;
            padding-bottom: 0;
          }

          .role {
            font-weight: 700;
            color: $primary;
            font-size: 0.95rem;
            max-width: 50%;
          }

          .name {
            color: #4a4a4a;
            font-size: 1rem;
            text-align: right;
          }
        }
      }
    }
  }
}

/* --- Responsive Adjustments --- */

@media screen and (max-width: 1024px) {
  .execomm-section .photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media screen and (max-width: 768px) {
  .execomm-section {
    padding-top: 7rem; 
    padding-bottom: 4rem;
    padding-inline: 1rem;

    h1 {
      font-size: 2rem; 
      margin-bottom: 2rem;
    }

    .banner-container {
      margin-bottom: 2rem;
      border-radius: 1rem;
    }
  }

  .image-modal .close-modal {
    top: 20px;
    right: 25px;
    font-size: 50px;
  }

  /* Mobile fix for the accordion (Put this inside your existing @media max-width: 768px block) */
  .past-committees-wrapper {
    margin-top: 4rem;

    h2 { font-size: 1.75rem; }

    .committee-accordion summary {
      padding: 1rem 1.25rem;
      font-size: 1.1rem;
    }

    .committee-accordion .accordion-content {
      padding: 1rem 1.25rem;

      ul li {
        flex-direction: column; /* Stacks the Role above the Name on small phones */
        align-items: flex-start;
        gap: 0.25rem;

        .role { max-width: 100%; }
        .name { text-align: left; }
      }
    }
  }
}

@media screen and (max-width: 480px) {
  .execomm-section .photo-grid {
    /* MAINTAINED 2 COLUMNS ON PHONE */
    grid-template-columns: repeat(2, 1fr); 
    gap: 1rem;
  }
}