.multi-select-container {
  position: relative;
  width: 100%;
  font-family: var(--font-primary, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);

  &.disabled {
    opacity: 0.6;
    pointer-events: none;
  }
}

.multi-select-label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.2s;
  pointer-events: none;
  
  &.has-value,
  &.focused {
    top: 0;
    font-size: 14px;
    color: var(--text-secondary);
  }
  
  &.required {
    .required-asterisk {
      color: var(--idt-danger);
      margin-left: 0.25rem;
    }
  }
}

.multi-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  color: var(--text-primary);

  &:hover:not(.disabled) {
    border-color: var(--idt-primary-color);
    box-shadow: 0 0 0 3px rgba(255, 200, 46, 0.1);
    transform: translateY(-1px);
  }

  &:focus:not(.disabled) {
    outline: none;
    border-color: var(--idt-primary-color);
    box-shadow: 0 2px 8px rgba(255, 200, 46, 0.2);
  }

  &.open {
    border-color: var(--idt-primary-color);
    box-shadow: 0 2px 8px rgba(255, 200, 46, 0.2);
    transform: translateY(-1px);
  }

  &.disabled {
    background: var(--surface-disabled, #f9fafb);
    border-color: var(--divider);
    cursor: not-allowed;
    opacity: 0.6;
  }

  &.has-value {
    .selected-display {
      color: var(--text-primary);
      font-weight: 500;
    }
  }

  .selected-display {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 0.75rem;
  }

  .actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
  }

  .clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s ease;

    &:hover {
      color: var(--idt-danger);
      background: rgba(235, 68, 90, 0.1);
    }

    i {
      font-size: 0.75rem;
    }
  }

  .dropdown-arrow {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: transform 0.2s ease;

    &.rotated {
      transform: rotate(180deg);
    }

    i {
      font-size: 0.75rem;
    }
  }
}

.multi-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin-top: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 16rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(-0.5rem);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

.dropdown-header {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-variant-subtle, rgba(0, 0, 0, 0.02));

  .action-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover:not(:disabled) {
      background: var(--hover-bg);
      color: var(--text-primary);
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    i {
      font-size: 0.75rem;
    }
  }
}

.options-list {
  flex: 1;
  overflow-y: auto;
  max-height: 12rem;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
  color: var(--text-primary);

  &:hover:not(.disabled) {
    background: var(--hover-bg);
  }

  &.selected {
    background: rgba(255, 200, 46, 0.1);
    color: var(--text-primary);

    .option-checkbox i {
      color: var(--idt-primary-color);
    }

    &:hover {
      background: rgba(255, 200, 46, 0.15);
    }
  }

  &.disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .option-checkbox {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;

    i {
      font-size: 1rem;
    }
  }

  .option-label {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 400;
  }
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-style: italic;
}

.dropdown-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--divider);
  background: var(--surface-variant-subtle, rgba(0, 0, 0, 0.02));

  .selection-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
  }
}

.backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: transparent;
  
  @media (max-width: 768px) {
    background: rgba(0, 0, 0, 0.3);
  }
}

// Responsive adjustments (following project's mobile patterns)
@media (max-width: 768px) {
  .multi-select-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 1rem 1rem 0 0;
    max-height: 70vh;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);

    @keyframes slideUp {
      from {
        transform: translateY(100%);
        opacity: 0;
      }
      to {
        transform: translateY(0);
        opacity: 1;
      }
    }
  }

  .multi-select-trigger {
    min-height: 3rem;
    padding: 1rem;
    font-size: 1rem;
    border-radius: 12px;

    .selected-display {
      font-size: 1rem;
    }
  }

  .option-item {
    padding: 1rem;
    font-size: 1rem;
    min-height: 3rem;

    .option-checkbox i {
      font-size: 1.125rem;
    }

    .option-label {
      font-size: 1rem;
    }
  }

  .dropdown-header {
    padding: 1rem;
    
    .action-btn {
      padding: 0.5rem 0.75rem;
      font-size: 0.875rem;
    }
  }
}

// Dark theme support (using project's dark theme variables)
.dark-theme {
  .multi-select-container {
    .multi-select-label {
      color: var(--text-primary);
    }

    .multi-select-trigger {
      background: var(--surface);
      border-color: var(--divider);
      color: var(--text-primary);

      &:hover:not(.disabled) {
        border-color: var(--idt-primary-color);
        box-shadow: 0 0 0 3px rgba(255, 200, 46, 0.1);
      }

      &.disabled {
        background: var(--surface-disabled);
        border-color: var(--divider);
      }

      .selected-display {
        color: var(--text-secondary);
      }

      &.has-value .selected-display {
        color: var(--text-primary);
      }
    }

    .multi-select-dropdown {
      background: var(--surface);
      border-color: var(--divider);
    }

    .dropdown-header {
      background: var(--surface-variant-subtle);
      border-color: var(--divider);
    }

    .option-item {
      color: var(--text-primary);

      &:hover:not(.disabled) {
        background: var(--hover-bg);
      }

      &.selected {
        background: rgba(255, 200, 46, 0.1);
        color: var(--text-primary);

        .option-checkbox i {
          color: var(--idt-primary-color);
        }
      }
    }

    .dropdown-footer {
      background: var(--surface-variant-subtle);
      border-color: var(--divider);
    }
  }
} 