// LLM UI Modal Components
// Provides consistent modal styling across all projects

.llm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: $z-modal;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: $transition-base;
  
  &.llm-modal--open {
    opacity: 1;
    visibility: visible;
  }
}

// Modal backdrop
.llm-modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: $z-modal-backdrop;
}

// Modal container
.llm-modal__container {
  position: relative;
  z-index: $z-modal;
  background-color: $bg-color;
  border-radius: $border-radius-lg;
  box-shadow: $shadow-xl;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: $transition-base;
  
  .llm-modal--open & {
    transform: scale(1);
  }
}

// Modal header
.llm-modal__header {
  padding: $spacing-lg;
  border-bottom: 1px solid $border-color;
  display: flex;
  align-items: center;
  justify-content: space-between;
  
  .llm-modal__title {
    font-size: $font-size-xl;
    font-weight: $font-weight-semibold;
    color: $heading-color;
    margin: 0;
  }
  
  .llm-modal__close {
    background: none;
    border: none;
    font-size: $font-size-xl;
    cursor: pointer;
    color: $muted-color;
    padding: $spacing-xs;
    border-radius: $border-radius;
    transition: $transition-base;
    
    &:hover {
      color: $text-color;
      background-color: $bg-alt;
    }
  }
}

// Modal body
.llm-modal__body {
  padding: $spacing-lg;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

// Modal footer
.llm-modal__footer {
  padding: $spacing-lg;
  border-top: 1px solid $border-color;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: $spacing-sm;
  background-color: $bg-alt;
}

// Modal sizes
.llm-modal--small {
  .llm-modal__container {
    width: 400px;
  }
}

.llm-modal--medium {
  .llm-modal__container {
    width: 600px;
  }
}

.llm-modal--large {
  .llm-modal__container {
    width: 800px;
  }
}

.llm-modal--full {
  .llm-modal__container {
    width: 95vw;
    height: 95vh;
    max-width: none;
    max-height: none;
  }
  
  .llm-modal__body {
    max-height: calc(95vh - 140px);
  }
}

// Modal variants
.llm-modal--primary {
  .llm-modal__header {
    background-color: $primary-light;
    border-bottom-color: $primary-color;
  }
  
  .llm-modal__title {
    color: $primary-color;
  }
}

.llm-modal--success {
  .llm-modal__header {
    background-color: $success-light;
    border-bottom-color: $success-color;
  }
  
  .llm-modal__title {
    color: $success-color;
  }
}

.llm-modal--warning {
  .llm-modal__header {
    background-color: $warning-light;
    border-bottom-color: $warning-color;
  }
  
  .llm-modal__title {
    color: $warning-color;
  }
}

.llm-modal--error {
  .llm-modal__header {
    background-color: $error-light;
    border-bottom-color: $error-color;
  }
  
  .llm-modal__title {
    color: $error-color;
  }
}

// Modal utilities
.llm-modal--centered {
  .llm-modal__container {
    margin: auto;
  }
}

.llm-modal--scrollable {
  .llm-modal__body {
    overflow-y: auto;
  }
}

.llm-modal--no-backdrop {
  .llm-modal__backdrop {
    display: none;
  }
}

// Modal animations
.llm-modal--fade {
  .llm-modal__container {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  
  &.llm-modal--open .llm-modal__container {
    opacity: 1;
    transform: translateY(0);
  }
}

.llm-modal--slide {
  .llm-modal__container {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  &.llm-modal--open .llm-modal__container {
    transform: translateX(0);
  }
}

// Modal content types
.llm-modal__content {
  &.llm-modal__content--form {
    .llm-form {
      margin: 0;
    }
  }
  
  &.llm-modal__content--list {
    .llm-list {
      margin: 0;
    }
  }
  
  &.llm-modal__content--table {
    .llm-table {
      margin: 0;
    }
  }
}

// Responsive modal
@media (max-width: 768px) {
  .llm-modal__container {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: $spacing-md;
  }
  
  .llm-modal__header,
  .llm-modal__body,
  .llm-modal__footer {
    padding: $spacing-md;
  }
  
  .llm-modal__footer {
    flex-direction: column;
    align-items: stretch;
    
    .llm-btn {
      width: 100%;
      margin-bottom: $spacing-sm;
      
      &:last-child {
        margin-bottom: 0;
      }
    }
  }
} 